EXAM PREP 2026 QUESTION BANK AND
ANSWER KEY MASTER CODING SKILLS SET
◉ String s1 = "Hello world";
String s2 = s1;
Answer: a. The s2 variable holds the string "Hello world".
a. The s2 variable holds a reference to the string "Hello world".
◉ Identify the method that returns the number of characters in a
string.
Answer: Length()
◉ Match the format specifiers with the data.
Answer: a. %d - integer
b. %e - scientific notation
c. %f - floating point
d. %c - character
e. %b - Boolean
f. %s - string
,◉ Identify the true statements regarding Java loops. Select ALL that
apply.
Answer: a. A while loop might not run at all.
b. A do-while loop always runs at least once.
c. Loops can be nested in other loops to any depth as desired.
◉ A while loop is a __?__ loop.
Answer: Pretest
◉ In which instance can a loop not require braces?
Answer: When only one statement is to be repeated
◉ The Java continue statement causes execution to skip to
Answer: The next iteration in the loop
◉ Int n;
For(n=8; n < 30; n += 5) {
//
}
System.out.print(n);
What is printed when the loop above has finished?
Answer: 33
, ◉ For (int n = 0; n <= 12; n++) {
System.out.print(n + "");
}
System.out.println(n);
What is the output of line 7?
Answer: Nothing. Compilation fails
◉ For(int I = 0; i < 6; i++) {
For(int j = 1; j <= 5; j++) {
System.out.print(I + j + " ");
}
System.out.println();
}
What is printed by the third iteration of the outer loop?
Answer: 3 4 5 6 7
◉ int x=1;
while(x <=5) {
x++;
System.out.print(x);
}