CHAPTER 5 (16-33, 34-70) REVIEW QUESTIONS Flashcards
For Exam 2
1
Q
- To __________ a value means to increase it by one, and to __________ a value means to decrease it by one.
A
- increment, decrement
2
Q
- When the increment or decrement operator is placed before the operand (or to the operand’s left), the operator is being used in __________ mode.
A
- prefix
3
Q
- When the increment or decrement operator is placed after the operand (or to the operand’s right), the operator is being used in __________ mode.
A
- postfix
4
Q
- The statement or block that is repeated is known as the __________ of the loop.
A
- body
5
Q
- Each repetition of a loop is known as a(n) __________.
A
- iteration
6
Q
- A loop that evaluates its test expression before each repetition is a(n) __________ loop.
A
- pretest
7
Q
- A loop that evaluates its test expression after each repetition is a(n) __________ loop.
A
- posttest
8
Q
- A loop that does not have a way of stopping is a(n) __________ loop.
A
- infinite or endless
9
Q
- A(n) __________ is a variable that “counts” the number of times a loop repeats.
A
- counter
10
Q
- A(n) __________ is a sum of numbers that accumulates with each iteration of a loop.
A
- running total
11
Q
- A(n) __________ is a variable that is initialized to some starting value, usually zero, and then has numbers added to it in each iteration of a loop.
A
- accumulator
12
Q
- A(n) __________ is a special value that marks the end of a series of values.
A
- sentinel
13
Q
- The __________ loop always iterates at least once.
A
- do-while
14
Q
- The __________ and __________ loops will not iterate at all if their test expressions are false to start with.
A
- while and for
15
Q
- The __________ loop is ideal for situations that require a counter.
A
- for
16
Q
- Inside the for loop’s parentheses, the first expression is the __________ , the second expression is the __________ , and the third expression is the __________.
A
- initialization, test, update
17
Q
- A loop that is inside another is called a(n) __________ loop.
A
- nested