What would happen if a semicolon is mistakenly placed at the end of a partial statement of a while loop with a Boolean expression and with an empty body?

What will be an ideal response?

If a semicolon is mistakenly placed at the end of the partial statement while (loopCount < 3);, the loop is also infinite. This loop has an empty body, or a body with no statements in it. So, the Boolean expression is evaluated, and because it is true, the loop body is entered. Because the loop body is empty, no action is taken and the Boolean expression is evaluated again. Nothing has changed, so it is still true, the empty body is entered, and the infinite loop continues.

Computer Science & Information Technology

You might also like to view...

To enable a printer to keep up with the amount of data sent to it by the computer, a ________ program is used.

a. print accelerator b. multitasking c. spooling d. switching

Computer Science & Information Technology

In Word, ________ are the space between text and the left, right, top, and bottom of the paper

Fill in the blank(s) with correct word

Computer Science & Information Technology