Professional Documents
Culture Documents
Java application?
A. Interface variables
B. Class variables
C. Instance variables
D. Local variables
4: int trees = 5;
5: System.out.print(trees+birds);
6: }
7: }
A. It does not compile.
color = "purple";
System.out.print(color);
new Bicycle().printColor("blue");
A. red
B. purple
C. blue
A. _blue
B. 2blue
C. blue$
D. Blue
7. Which of these class names best follows standard Java naming conventions?
A. fooBar
B. FooBar
C. FOO_BAR
D. F_o_o_B_a_r
package beach;
public Sand() {
System.out.print("a");
System.out.print("b");
new Sand();
Sand();
new Sand().run();
A. a
B. ab
C. aab
A. String
B. double
C. int
D. char
10) What is the value of thatNumber after the execution of the following code snippet?
if(++thatNumber < 4)
thatNumber += 1;
A. 3
B. 4
C. 5
D. The answer cannot be determined until runtime.
package restaurant;
System.out.print("Not enough");
} if(flair==37) {
System.out.print("Just right");
} else {
System.out.print("Too many");
A. Not enough
B. Just right
C. Too many
package schedule;
A. 56789
B. 11789
C. 11717
D. The code does not compile.
package mode;
System.out.print(travel(500));
A. train
B. 10
System.out.println(days[i]);
A. Six
B. Seven
15)Which type of loop is best known for its boolean condition that controls entry to the loop?
A. do-while loop
B. for (traditional)
C. for-each
D. while
16) Which type of loop is best known for using an index or counter?
A. do-while loop
B. for (traditional)
C. for-each
D. while
17Which of the following is equivalent to this code snippet given an array of String objects?
System.out.println(fun[i]);
int singer = 0;
System.out.println(singer++);
A. 0
do {
if (!balloonInflated) {
balloonInflated = true;
System.out.print("inflate-");
} while (! balloonInflated);
System.out.println("done");
A. done
B. inflate-done
14: result++;
15: do {
16: result--;
19: }
20: System.out.println(result);
A. 5
B. 8