click below
click below
Normal Size Small Size show me how
Loops
| Question | Answer |
|---|---|
| C++ has three ___ (repetition) structures: while, for, and do. . .while | Looping |
| In the while statement, the ___ around the expression (the decision maker) are important; they mark the beginning and end of the expression | Parentheses |
| The body of the while loop must contain a statement that eventually sets the expression to ___ | False |
| In a counter-controlled while loop, you must ___ the counter before the loop, and the body of the loop must contain a statement that changes the value of the counter variable | Initialize |
| A ___ is a special value that marks the end of the input data. The sentinel must be similar to, yet differ from, all the data items | Sentinel |
| A sentinel-controlled while loop uses a sentinel to control the while loop. The while loop continues to execute ___ the sentinel is read | Until |
| A ___ loop simplifies the writing of a counter-controlled while loop | For |
| Putting a ___ at the end of the for loop (before the body of the for loop) is a semantic error | Semicolon ; |
| Both while and for loops are called pretest loops. A do. . .while loop is called a ___ loop | Posttest |
| The while and for loops may not execute at all, but the do. . .while loop always executes at least ___ | Once |
| Executing a ___ statement in the body of a loop immediately terminates the loop | Break |
| Executing a ___ statement in the body of a loop skips the loop’s remaining statements and proceeds with the next iteration | Continue |