Chapter 13 You can fix the problem in the Posttest Loop

subject Type Homework Help
subject Pages 3
subject Words 560
subject Authors Diane Zak

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Chapter 13: Do It, Then Ask Permission (Posttest Loops)
TRUE/FALSE
1. A repetition structure can be either a pretest loop or a posttest loop.
2. The difference between pretest and posttest loops pertains to how the accumulator is evaluated.
3. The instructions in a pretest loop will be processed at least once.
4. Most programmers prefer to use posttest loops.
5. A pretest loop is easier to write and understand than a posttest loop with a selection structure.
6. The Do…Loop statement can be used to code a pretest loop as well as a posttest loop.
7. In the pretest syntax, the condition is evaluated after the loop instructions are processed.
8. In the posttest syntax, the condition is evaluated before the loop instructions are processed.
9. In the posttest syntax, the only purpose of the Do clause is to mark the beginning of the loop.
10. Pretest loops should be used only when their instructions must be processed at least once.
11. The diamond that represents the condition appears at the top of the loop in the flowchart of a posttest
loop.
12. When a posttest loop is placed in a selection structure, the loop will be processed only when the
selection structure’s condition evaluates to True.
page-pf2
MULTIPLE CHOICE
1. The ____ loop condition is evaluated before the instructions within the loop are processed.
a.
posttest
c.
before
b.
pretest
d.
after
2. The ____ loop condition is evaluated after the instructions within the loop are processed.
a.
posttest
c.
before
b.
pretest
d.
after
3. The instructions in a posttest loop ____.
a.
may never be processed
c.
will always be processed at least twice
b.
should only be processed once
d.
will always be processed at least once
4. In the ____ loop, the condition appears in the first line.
a.
sequential
c.
posttest
b.
pretest
d.
iterative
5. In the ____ loop, the condition appears in the last line.
a.
sequential
c.
posttest
b.
pretest
d.
iterative
6. ____ loops should be used only when their instructions must be processed at least once.
a.
Posttest
c.
DoAfter
b.
Pretest
d.
ProcessAfter
7. A game program uses the ____ loop to control the display of the menu, which must appear on the
screen at least once.
a.
prettest
c.
DoAfter
b.
posttest
d.
ProcessAfter
8. In the pretest syntax for a Do…Loop statement, the {While | Until} condition section is part of
the ____ clause.
a.
Execute
c.
Do
b.
Process
d.
Loop
9. In the posttest syntax for a Do…Loop, the {While | Until} condition section is part of the ____
clause.
page-pf3
a.
Execute
c.
Do
b.
Process
d.
Loop
10. You are given the following statement:
Do ... Loop Until intCounter > intNumTimes.
The Until intCounter > intNumTimes represents a ____.
a.
loop condition
c.
loop full condition
b.
loop exit condition
d.
loop retreat condition
11. One problem with posttest loops is that they always execute at least once. You can fix the problem in
the Posttest Loop button’s code by placing the posttest loop in a(n) ____ structure.
a.
selection
c.
iterative
b.
execute
d.
another posttest loop
12. You may test an initial condition of a posttest loop by ____.
a.
using a nested loop for the initial condition
b.
placing the posttest loop inside a selection structure
c.
resetting the counter variable on each pass of the loop
d.
initializing all loop variables to zero

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.