chapter 5 review questions
The following statement decrements the variable x: Set x = x - 1.
True
The For loop is a __ type of loop. *a. pretest* *b. posttest* *c. prequalified* *d. post iterative*
a. pretest
The While loop is a ___ type of loop *a. pretest* *b. posttest* *c. prequalified* *d. post iterative*
a. pretest
A(n) __ is a special value that marks the end of a sequence of items. *a. sentinel* *b. flag* *c. signal* *d. accumulator*
a. sentinel
A ___-controlled loop uses a true/false condition to control the number of times that it repeats. *a. Boolean* *b. condition* *c. decision* *d. count*
b. condition
A ___ loop always executes at least once. *a. pretest* *b. posttest* *c. condition-controlled* *d. count-controlled*
b. posttest
The do-while loop is a ___ type of loop. *a. pretest* *b. posttest* *c. prequalifed* *d. post iterative*
b. posttest
A(n) ___ loop has no way of ending and repeats until the program is interrupted. *a. interderminate* *b. interminable* *c. infinite* *d. timeless*
c. infinite
A(n) variable keeps a running total. *a. sentinel* *b. sum* *c. total* *d. accumulator*
d. accumlator
A ___-controlled loop repeats a specific number of times. *a. boolean* *b. condition* *c. decision* *d. count*
d. count
Each repetition of a loop is known as a(n) __________. *a. cycle* *b. revolution* *c. orbit* *d. iteration*
d. iteration
(T/F) A condition-controlled loop always repeats a specific number of times.
false
(T/F) To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops.
false
(T/F) the do-while loop is a pretest loop.
false
T/F It's not necessary to initialize accumulator variables.
false
T/F It's not possible to increment a counter variable by any other value than one.
false
T/F You cannot display the contents of the counter variable in the body of the loop.
false
(T/F) In a nested loop, the inner loop goes through all of its iterations for every single iteration of the outer loop
true
(T/F) The while loop is a pretest loop.
true
(T/F) You should not write code that modifies the contents of the counter variable in the body of a For loop.
true
