CS 159 Lab 8 True or False
Minimum # of times loop is iterated in a Pretest Loop
0
Minimum # of times loop is iterated in a Post-test Loop
1
In an event-controlled loop we know the number of times that the actions found inside the body of the loop will be executed.
F
In an event-controlled loop we know the total number of times that the actions found inside the body of the loop will be executed.
F
No semi-colon is used after the loop control expression for a do while loop.
F
The first expression in a for loop is to declare and initialize the loop control variable.
F
The for loop is usually applied to event-controlled processes.
F
The number of times that the loop control expression is evaluated is one more than the number of iterations in a post-test loop.
F
A counter-controlled loop may execute a constant number of iterations.
T
A semi-colon is used after the loop control expression for a do while loop.
T
Any statement, even another for loop, can be included in the body of a for loop.
T
Functions that make use of loops can vary widely in their efficiency.
T
Good structured programming practices limit the use of the break command to switch constructs.
T
If you think you need to make use of the continue statement then your algorithm may not be well structured.
T
In a counter-controlled loop we know the number of times that the actions found inside the body of the loop will be executed.
T
It is not a recommended coding technique to update the loop control variable in the body of a for loop rather than making use of the third expression.
T
It is possible for the number of times a counter-controlled loop will iterate to depend on the value of a single variable or expression.
T
No semi-colon is used after the loop control expression for a while loop.
T
The ability to complement a logical expression is important because programmers often consider what must happen for a loop to terminate rather than the conditions that should keep it going.
T
The do while loop is commonly used in the process of data validation.
T
The do while loop will test the loop control expression after the execution of the statements found inside the body of loop.
T
The do while loop will test the loop control expression after the execution of the statements found inside the body of loop.
T
The efficiency of an algorithm is one measure to determine when one solution should be preferred to another.
T
The first expression in a for loop is to initialize the loop control variable.
T
The for loop is used when a loop is to be executed a known number of times.
T
The for loop is usually used for counter-controlled processes.
T
The loop control expression is evaluated before every iteration of a pretest loop, including the first iteration.
T
The number of times that the loop control expression is evaluated is one more than the number of iterations in a pretest loop.
T
The second expression in a for loop is executed prior to every iteration.
T
The second expression in a for loop is the loop control expression.
T
The third expression in a for loop is the update expression that changes the loop control variable.
T
# of times actions inside the body of the loop are executed in a Post-test Loop
n
# of times actions inside the body of the loop are executed in a Pretest Loop
n
# of times loop control expression is evaluated in a Post-test Loop
n
# of times loop control expression is evaluated in a Pretest Loop
n + 1