System.out.println(“Welcome to Java”);
count++;
} while (count < 10);
A. 8
B. 0
C. 11
D. 10
E. 9
#
4. What is i after the following for loop is finished?
int y = 0;
for (int i = 0; i<10; ++i) {
y += i;
}
A. 10
B. undefined
C. 9
D. 11
#
5. Analyze the following code:
public class Test {
public static void main (String args[]) {
int i = 0;
for (i = 0; i < 10; i++);
System.out.println(i + 4);
}
}
A. The program compiles despite the semicolon (;) on the for loop line, and displays 4.
B. The program compiles despite the semicolon (;) on the for loop line, and displays 14.
C. The program has a compile error because of the semicolon (;) on the for loop line.
D. The program has a runtime error because of the semicolon (;) on the for loop line.
#
6. Which of the following expression yields an integer between 0 and 100, inclusive?