What is the value in count after the following loop is executed?
int count = 0;
do {
System.out.println("Welcome to Java");
} while (count++ < 9);
System.out.println(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 for the first time when count is 0 . (count++ < 9) increments count by 1 and uses the old count value to check if count < 9 . So, the loop is executed 10 times for count from 0 to 9 . Note that when count is 9, the loop body is executed and then count++ increments count to 10 . The previous count value 9 < 9 is false. So the loop is finished. Now count becomes 10 after the loop exits. The correct answer is C.
You might also like to view...
The ____________________ plan defines a set of explicit actions that the organization plans to take, to ensure that each EBK role properly executes its requisite management functions.
Fill in the blank(s) with the appropriate word(s).
In Excel, D9 is an example of a cell ________
Fill in the blank(s) with correct word
What is text analytics?
What will be an ideal response?
Match each item with a statement below.
A. A connectionless protocol that uses IP to get packets from one computer to another. B. A connectionless protocol used for sending and receiving requests between the client and server on a network. C. A protocol used to generate IP error messages. D. A protocol used to send e-mail in user-level client applications. E. A virtual terminal protocol for connecting to a remote computer. F. A protocol used to map a fully qualified domain name with an IP address. G. A connection-oriented protocol responsible for keeping track of packets and reassembling them into a single file after they have all arrived. H. A protocol used to move files from one computer to another efficiently and accurately. I. A protocol that handles the delivery of data as packets.