Given:
What is the result?
A. 400 200
B. 200 200
C. 400 400
D. Compilation fails.
Given: What is the result?
A. 200.0 : 100.0
B. 400.0 : 200.0
C. 400.0 : 100.0
D. Compilation fails.
Given the definitions of the MyString class and the Test class:
What is the result?
A. Option A
B. Option B
C. Option C
D. Option D
Given:
public class Natural {
private int i;
void disp() {
while (i <= 5) {
for (int i=1; i <=5;) {
System.out.print(i + " ");
i++;
}
i++;
}
}
public static void main(String[] args) {
new Natural().disp();
}
}
What is the result?
A. Prints 1 2 3 4 5 once
B. Prints 1 3 5 once
C. Prints 1 2 3 4 5 five times
D. Prints 1 2 3 4 5 six times
E. Compilation fails
Given the code fragment
int var1 = -5;
int var2 = var1--;
int var3 = 0;
if (var2 < 0) {
var3 = var2++;
} else {
var3 = --var2;
}
System.out.println(var3);
What is the result?
A. ?6
B. ?4
C. ?5
D. 5
E. 4
F. Compilation fails
Given:
Which two code fragments are valid?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
Given the code fragment:
Which three code fragments are valid at line n1? (Choose three.)
Given the code fragments:
Which modification enables the code to compile?
A. B.
C. D.
Given: What is the result?
A. 100 0 : 100 200:
B. 100 0 : 100 0 :
C. 100 200 : 100 200 :
D. 100 200 : 0 0 :
Which is true about the switch statement?
A. Its expression can evaluate to a collection of values.
B. The break statement, at the end of each case block, is optional.
C. Its case label literals can be changed at runtime.
D. It must contain the default section.