ANSWERS
Which of the following statements is TRUE? - Answer- If the loop condition in a for loop
is initially false, the loop body does not execute
Which of the following is the general form of the do...while statement? - Answer- do
statement while (expression);
A _____ is a special value that marks the end of the input data. - Answer- sentinel
The _____ loop is a pretest loop. - Answer- while
Putting one control structure inside another is called ____. - Answer- nesting
The most common error associated with loops is a(n) _____ error. - Answer- off-by-one
When the ____ statement executes in a repetition structure, it immediately exits from
the structure. - Answer- break
The _____ statement is an effective way to avoid extra variables to control a loop and
produce elegant code. - Answer- break
When a program reads past the end of the input file, the expression ____ becomes
false. - Answer- !infile.eof()
The C++ eof function is a member of the data type ____. - Answer- istream
The function rand() is defined in the header file ____. - Answer- cstdlib
In a for structure, the _____ statement is executed after the continue statement, and
before the loop condition executes. - Answer- update
Which of the following is a Fibonacci sequence? - Answer- 1,1,2,3,5,8
A semicolon at the end of a for statement _____ the for loop. - Answer- Terminates
The ____ loop is a posttest loop. - Answer- do...while