Will the following program terminate?
int balance = 10;
while (true) {
if (balance < 9)
continue;
balance = balance - 9;
}
a. Yes
b. No
b Before the loop, balance is 10 . In the loop, balance becomes 1 . The loop-continuation-condition is always true. When balance < 9 is true, the continue statement is executed to skip the rest statement in the iteration. So the loop continues in an infinite loop. So, the correct answer is B.
You might also like to view...
Durations can be ____.
A. hard or fast B. managed or calculated C. estimated or firm D. determinate or indeterminate
In Windows 8.1 Administrative Tools, what do you use to view and edit Group Policy security settings?
a. Event Viewer b. Local Security Policy c. System Configuration d. Task Scheduler
What is the part of the computer system that receives inputs, directs those inputs to the processor, and redirects the processed data to outputs called?
a. CPU b. Interface card c. Controller chip d. Southbridge e. System Board f. PCI Mastering
List four different categories of utility tools support agents find useful to provide support for operating system problems.
What will be an ideal response?