System.out.println(“x”);
}
a. The value of variable x is always printed.
b. The symbol x is always printed twice.
c. The symbol x is always printed.
d. Nothing is printed because x > 0 is false.
#
8. To declare a constant MAX_LENGTH inside a method with value 99.98, you
write
a. final double MAX_LENGTH = 99.98;
b. double MAX_LENGTH = 99.98;
c. final MAX_LENGTH = 99.98;
d. final float MAX_LENGTH = 99.98;
#
9. Which of the following is a constant, according to Java naming
conventions?
a. read
b. MAX_VALUE
c. ReadInt
#
10. What is y after the following switch statement is executed?
x = 3;
switch (x + 3) {
case 6: y = 0;
case 7: y = 1;
default: y += 1;
}
a. 1
b. 4
c. 3
d. 2
#
11. Which of the following code displays the area of a circle if the radius is
positive.
a. if (radius <= 0) System.out.println(radius * radius * 3.14159);
b. if (radius != 0) System.out.println(radius * radius * 3.14159);