Will the following program terminate?
int balance = 10;
while (true) {
if (balance < 9)
break;
balance = balance - 9;
}
a. Yes
b. No
a Yes. Before the loop, balance is 10 . The loop-continuation-condition is always true. In the first iteration, balance is reduced to 1 . In the second iteration, the break statement is executed since (balance < 9) is now true. The correct answer for this question is A.
You might also like to view...
Identify the compiler errors in Problems and state what is wrong with the code.
``` int list{25},i; float a, b, c; for(i = 0, i<25; ++i) { listi = 0.0; } ```
Your account on several Web sites serves as your ____.
A. VeriSign B. OpenID C. LiveID D. claimID
When a menu control’s _________ property equals True, a check appears next to the menu item.
a. showCheck b. Checked c. Check d. none of the above
To speed up searches, Windows maintains a(n) ________ that contains information about files located on your computer
Fill in the blank(s) with correct word