TRUE/FALSE
1. The loop control variable is initialized after entering the loop.
ANS: F PTS: 1 REF: 171
2. In some cases, a loop control variable does not have to be initialized.
ANS: F PTS: 1 REF: 171
3. An indefinite loop is a loop that never stops.
ANS: F PTS: 1 REF: 173
4. You can either increment or decrement the loop control variable.
ANS: T PTS: 1 REF: 173
5. When one loop appears inside another is is called an indented loop.
ANS: F PTS: 1 REF: 177
6. Forgetting to initialize and alter the loop control variable is a common mistake that programmers
sometimes make.
ANS: T PTS: 1 REF: 183
7. Every high-level computer programming language contains a while statement.
ANS: T PTS: 1 REF: 192
8. Both the while loop and the for loop are examples of pretest loops.
ANS: T PTS: 1 REF: 193
9. The safest action is to assign the value 1 to accumulators before using them.
ANS: F PTS: 1 REF: 197
10. It is the programmer’s responsibility to initialize all variables that must start with a specific value.
ANS: T PTS: 1 REF: 198
MULTIPLE CHOICE
1. The first step in a while loop is typically to ____.
a. compare the loop control variable to a constant value
b. initialize the loop control variable
c. increment the loop control variable
, d. execute the body of the loop
ANS: B PTS: 1 REF: 171
2. Once your logic enters the body of a structured loop, ____.
a. the entire loop must execute
b. the loop can be terminated with a break statement
c. the loop will execute indefinitely
d. a decision statement will be evaluated
ANS: A PTS: 1 REF: 171-172
3. The last step in a while loop is usually to ____.
a. compare the loop control variable to a constant value
b. initialize the loop control variable
c. increment the loop control variable
d. execute the body of the loop
ANS: C PTS: 1 REF: 172
4. A(n) ____ loop executes a predetermined number of times.
a. terminal c. indefinite
b. definite d. infinite
ANS: B PTS: 1 REF: 172
5. Many loop control variable values are altered by ____, or adding to them.
a. incrementing c. accumulating
b. decrementing d. deprecating
ANS: A PTS: 1 REF: 173
6. A(n) ____ is any numeric variable you use to count the number of times an event has occurred.
a. accumulator c. index
b. key d. counter
ANS: D PTS: 1 REF: 173
7. A loop within another loop is known as a(n) ____ loop.
a. indefinite c. nested
b. infinite d. hidden
ANS: C PTS: 1 REF: 177
8. When one loop appears inside another, the loop that contains the other loop is called the ____ loop.
a. indefinite c. inner
b. definite d. outer
ANS: D PTS: 1 REF: 177
9. Usually, when you create nested loops, each loop has its own ____.
a. sentinel value c. entrance condition
b. goto statement d. loop control variable
ANS: D PTS: 1 REF: 177
10. A mistake programmers often make with loops is that they ____.