BTE320 Chapter 5
invariant
A loop ____________________ is a set of statements that remains true each time the loop body is executed.
looping
In ____ structures, the computer repeats particular statements a certain number of times depending on some condition(s).
for loop
When a continue statement is executed in a ____, the update statement always executes.
do...while
____ loops are called posttest loops
infinite
a loop that continues to execute endlessly is called an ____ loop
semantic
a semicolon at the end of the for statement (just before the body of the loop) is a ____ error
flag
an ___ controlled while loop uses a bool variable to control the loop
true
in a counter controlled while loop, the loop control variable must be initialized before the loop
false
in a sentinel controlled while loop, the body of the loop continues to execute until the EOF symbol is read
pretest
in a while and for loop, the loop condition is evaluated before executing the body of the loop. therefore, m while and for loops are called ___ loops
true
in the case of a sentinel controlled while loop, the first item is read before the while loop is entered
break
the ___ statement can be used to eliminate the use of certain (flag) variables
break
the ____ statement is typically used for two purposes : 1- to exit early from a loop 2- to skip the remainder of the switch structure
true
the control statements in the for loop include the initial statement, loop condition, and update statement
true
the control variable in a flag controlled while loop is a bool variable
istream
the function eof is a member of the data type ____
true
the number of iterations of a counter controlled loop is known in advance
false
the statement in the body of a while loop acts as a decision maker
cstdlib
to generate a random number, you can use the function rand of the header file _____
do...while loop
type of loop guaranteed to execute at least once
do...while loop
type of loop that does not have an entry condition
loop continue test
what executes immediately after a continue statement in a while and do-while loop?