How many times will the following code print "Welcome to Java"?
int count = 0;
do {
System.out.println("Welcome to Java");
} while (count++ < 10);
a. 8
b. 9
c. 10
d. 11
e. 0
d The count is initialized to 0 before the loop. The loop is executed for the first time when count is 0 . (count++ < 10) increments count by 1 and uses the old count value to check if count < 10 . So, the loop is executed 11 times for count from 0 to 10 . Note that when count is 10, the loop body is executed before the loop is exited. The correct answer is D.
You might also like to view...
What are the two main factors that affect how smooth the animation is in the Rebound program? Explain how changing either would affect it.
What will be an ideal response?
Research indicates that users almost always have at least a(n) ____ screen resolution.
A. 2400 x 1870 B. 1600 x 1024 C. 1200 x 800 D. 1024 x 768
What does the DWORD value store?
What will be an ideal response?
As shown in the accompanying figure, the red box in the Date Navigator indicates the current date.
Answer the following statement true (T) or false (F)