Name:     ID: 
 
Email: 

C++ Quiz

True/False
Indicate whether the statement is true or false.
 

 1. 

You should not nest repetition structures.
 

 2. 

The difference between pretest and posttest loops is that in posttest loops the condition is not evaluated with each iteration of the loop, whereas in pretest loops it is.
 

 3. 

Depending on the result of the evaluation, the instructions in a posttest loop may never be processed.
 

 4. 

Of the two types of loops, the posttest loop is the most commonly used.
 

 5. 

Not every problem requires a loop in its solution.
 

 6. 

A loop condition must result in either a true or false answer only.
 

 7. 

In a pretest loop, when the loop condition evaluates to false, the loop body is processed; otherwise, the loop body instructions are skipped over.
 

 8. 

When coding the while statement, some C++ programmers include the braces even when the loop body contains only one statement.
 

 9. 

The loop condition of the while statement cannot contain arithmetic operators.
 

 10. 

An accumulator is always incremented by a constant value, whereas a counter is incremented by a value that varies.
 

Multiple Choice
Identify the choice that best completes the statement or answers the question.
 

 11. 

Pretest loops are also called ____ loops.
a.
top-driven
c.
primary
b.
bottom-driven
d.
secondary
 

 12. 

The repetition structure is referred to more simply as a ____.
a.
multi-path
c.
loop
b.
case
d.
switch
 

 13. 

Posttest loops are also called ____ loops.
a.
top-driven
c.
primary
b.
bottom-driven
d.
secondary
 

 14. 

The instructions in a ____ loop will be processed at least once.
a.
for
c.
pretest
b.
while
d.
posttest
 

 15. 

After each processing of the loop body instructions, the loop ____ is reevaluated to determine whether the instructions should be processed again.
a.
condition
c.
iterator
b.
body
d.
sentinel
 

 16. 

You can code the pretest loop in C++ using the ____ statement.
a.
repeat
c.
for
b.
switch
d.
do while
 

 17. 

When coding the while statement in C++, the loop condition must be a(n) ____ expression.
a.
arithmetic
c.
logical
b.
relational
d.
Boolean
 

 18. 

Usually, you can stop a program that contains an infinite loop by pressing ____.
a.
Ctrl+e
c.
Ctrl+s
b.
Ctrl+c
d.
Ctrl+x
 

 19. 

A(n) ____ is a numeric variable used for adding together something, such as the total dollar amount of a week’s payroll.
a.
sentinel
c.
counter
b.
iterator
d.
accumulator
 

 20. 

A common error made by C++ programmers is to separate the arguments in the for clause with ____.
a.
colons
c.
commas
b.
semicolons
d.
dashes
 



 
         Start Over