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 {
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?
A. (int)(Math.random() * 100 + 1)
B. (int)(Math.random() * 101)
C. (int)(Math.random() * 100)
D. (int)(Math.random() * 100) + 1
#
7 Analyze the following code.
int count = 0;