How many times will the following code print "Welcome to Java"?
int count = 0;
while (count < 10) {
System.out.println("Welcome to Java");
count++;
}
a. 8
b. 9
c. 10
d. 11
e. 0
c The count is initialized to 0 before the loop. The loop is executed 10 times for count from 1 to 9 . When count is 10, the loop continuation condition becomes false. The loop is finished. So, the correct answer is C.
You might also like to view...
A statement that starts with a hashtag (or pound) symbol (#) is called a
a. comment b. function c. preprocessor directive d. header file e. None of these
Why is the integrity of the evidence in a legal process important?
What will be an ideal response?
Which is NOT accomplished using the buttons available in the Paragraph group of the Home tab?
A) Format indents B) Format spacing C) Format font D) Format borders
Companies that are planning to make a long-term investment, like the purchase of machinery, typically use ________ to evaluate whether the endeavor is worth pursuing
A) capital budgeting B) amortization table C) cash flows D) present value analysis