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.
Computer Science & Information Technology
You might also like to view...
A good practice is to save your file every few minutes
Indicate whether the statement is true or false
Computer Science & Information Technology
The output reports:
a. Should print all fields in a record. b. Should print only relevant fields from a record. c. Should print all records from the table. d. None of the above.
Computer Science & Information Technology