Will the following program terminate?

```
int balance = 10;

while (true) {
if (balance < 9)
continue;
balance = balance - 9;
}
```

a. Yes
b. No

b. No
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.

Computer Science & Information Technology

You might also like to view...

If the ________ error code displays, you probably mistyped something

A) #ERROR! B) #ENTRY! C) #TYPO! D) #VALUE!

Computer Science & Information Technology

The ________ and ________ operators can respectively be used to increment and decrement a pointer variable.

A) dereferencing, indirection B) modulus, division C) ++, -- D) All of the above E) None of the above

Computer Science & Information Technology