x
Info
x
Warning
x
Danger
 / 
 / 
 / 
31.Variables of the boolean data type useful for a.working with small

Question : 31.Variables of the boolean data type useful for a.working with small : 2007985

31.Variables of the boolean data type are useful for

a.working with small integers

b.evaluating true/false conditions

c.working with very large integers

d.evaluating scientific notation

32.What is the result of the following expression?

25 - 7 * 3 + 12 / 3

a.6

b.8

c.10

d.12

33.What is the result of the following expression?

17 % 3 * 2 - 12 + 15

a.7

b.8

c.12

d.105

34.What will be displayed after the following statements have been executed?

int x = 15, y = 20, z = 32;

x += 12;

y /= 6;

z -= 14;

System.out.println("x = " + x +

", y = " + y +

", z = " +z);

a.x = 27, y = 3.333, z = 18

b.x = 27, y = 2, z = 18

c.x = 27, y = 3, z = 18

d.x = 37, y = 14, z = 4

35.What will be the value of z after the following statements have been executed?

int x = 4, y = 33;

double z;

z = (double) (y / x);

a.8.25

b.4

c.8

d.8.0

36.This is a variable whose content is read only and cannot be changed during the program's execution.

a.operator

b.literal

c.named constant

d.reserved word

37.What will be displayed after the following statements have been executed?

final double x;

x = 54.3;

System.out.println("x = " + x );

a.x = 54.3

b.x

c.x = 108.6

d.Nothing, this is an error.

38.Which of the following is a valid Java statement?

a.String str = 'John Doe';

b.string str = "John Doe";

c.string str = 'John Doe';

d.String str = "John Doe";

39.What will be displayed as a result of executing the following code?

int x = 8;

String msg = "I am enjoying java.";

String msg1 = msg.toUpperCase();

String msg2 = msg.toLowerCase();

char ltr = msg.charAt(x);

int strSize = msg.length();

System.out.println(msg);

System.out.println(msg1);

System.out.println(msg2);

System.out.println("Character at index x = " +

ltr);

System.out.println("msg has " + strSize +

" characters.");

a.I am enjoying java.

I AM ENJOYING JAVA.

i am enjoying java.

Character at index x = j

msg has 20 characters.

b.I am enjoying java.

I AM ENJOYING JAVA.

i am enjoying java.

Character at index x = o

msg has 20 characters.

c.I am enjoying java.

I AM ENJOYING JAVA.

i am enjoying java.

Character at index x = o

msg has 19 characters.

d.I am enjoying java.

I AM ENJOYING JAVA.

i am enjoying java.

Character at index x = y

msg has 19 characters.

40.Which of the following does not describe a valid comment in Java?

a.Single line comments, two forward slashes - //

b.Multi-line comments, start with /* and end with */

c.Multi-line comments, start with */ and end with /*

d.Documentation comments, any comments starting with /** and ending with */

41.Which of the following statements correctly creates a Scanner object for keyboard input?

a.Scanner kbd = new Scanner(System.keyboard);

b.Scanner keyboard(System.in);

c.Scanner keyboard = new Scanner(System.in);

d.Keyboard scanner = new Keyboard(System.in);

42.Which Scanner class method reads an int?

a.readInt()c.getInt()

b.nextInt()d.read_int()

43.Which Scanner class method reads a String?

a.readString()c.getString()

b.nextString()d.nextLine()

Solution
5 (1 Ratings )

Solved
Computer Science 8 Months Ago 145 Views
This Question has Been Answered!
Unlimited Access Free
Explore More than 2 Million+
  • Textbook Solutions
  • Flashcards
  • Homework Answers
  • Documents
Signup for Instant Access!
Ask an Expert
Our Experts can answer your tough homework and study questions
154368 Computer Science Questions Answered!
Post a Question