Programming Logic & Design - Chap. 5
Looping Review Questions and
Answers
Adding 1 to a variable is also called _______________ it.
Select one:
a. digesting
b. incrementing
c. resetting
d. decrementing - ANSWER-b. incrementing
Which of the following is a definite loop?
Select one:
a. a loop that executes as long as a user continues to enter valid data
b. a loop that executes 1,000 times
c. both of the above
d. none of the above - ANSWER-d. none of the above
Which of the following is an indefinite loop?
Select one:
a. a loop that executes exactly 10 times
b. a loop that follows a prompt that asks a user how many repetitions to make and
uses the value to control the loop
c. both of the above
d. none of the above - ANSWER-b. a loop that follows a prompt that asks a user how
many repetitions to make and uses the value to control the loop
When two loops are nested, the loop that is contained by the other is the
_______________loop.
Select one:
a. captive
b. unstructured
c. inner
d. outer - ANSWER-c. inner
When loops are nested, _______________.
Select one:
a. they typically share a loop control variable
b. one must end before the other begins
c. both must be of the type-definite or indefinite
d. none of the above - ANSWER-d. none of the above
Most programmers use a for loop _______________.
Select one:
a. when they know the exact number of times a loop will repeat
Looping Review Questions and
Answers
Adding 1 to a variable is also called _______________ it.
Select one:
a. digesting
b. incrementing
c. resetting
d. decrementing - ANSWER-b. incrementing
Which of the following is a definite loop?
Select one:
a. a loop that executes as long as a user continues to enter valid data
b. a loop that executes 1,000 times
c. both of the above
d. none of the above - ANSWER-d. none of the above
Which of the following is an indefinite loop?
Select one:
a. a loop that executes exactly 10 times
b. a loop that follows a prompt that asks a user how many repetitions to make and
uses the value to control the loop
c. both of the above
d. none of the above - ANSWER-b. a loop that follows a prompt that asks a user how
many repetitions to make and uses the value to control the loop
When two loops are nested, the loop that is contained by the other is the
_______________loop.
Select one:
a. captive
b. unstructured
c. inner
d. outer - ANSWER-c. inner
When loops are nested, _______________.
Select one:
a. they typically share a loop control variable
b. one must end before the other begins
c. both must be of the type-definite or indefinite
d. none of the above - ANSWER-d. none of the above
Most programmers use a for loop _______________.
Select one:
a. when they know the exact number of times a loop will repeat