wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

The Coming Apocalypse Test (Coding I Chapter 7 SG)

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

True or False?

A looping condition tells the computer when to exit a loop.

a)

True

b)

False

2.

True or False?

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.

a)

True

b)

False

3.

True or False?

Not every problem requires a loop in it’s solution.

a)

True

b)

False

4.

True or False?

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

a)

True

b)

False

5.

True or False?

With very rare exceptions, every loop has a loop condition and a loop body.

a)

True

b)

False

6.

True or False?

Values used to end loops are sometimes called sentile values.

a)

True

b)

False

7.

True or False?

In flowcharts, the parallelogram is the selection/repetition symbol.

a)

True

b)

False

8.

True or False?

When coding the while statement, you may include braces around the loop body even when it contained only one statement.

a)

True

b)

False

9.

True or False?

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

a)

True

b)

False

10.

True or False?

A loop that processes it’s instructions indefinitely is referred to an an infinite loop.

a)

True

b)

False

11.

True or False?

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

a)

True

b)

False

12.

True or False?

The second argument in the for clause usually contains an expression that updates the counter variable specified in the initialization argument.

a)

True

b)

False

13.

True or False?

In the for statement, if the loop body contains more than one statement, the statements must be entered as a statement block.

a)

True

b)

False

14.

True or False?

The update argument in the for clause usually contains an expression that updates the counter variable specified in the initialization argument.

a)

True

b)

False

15.

True or False?

A programmer must provide all three arguments in a for clause

a)

True

b)

False

16.

In a ___ loop, the evaluation occurs after the instructions within the loop are processed.

a)

for

b)

pretest

c)

posttest

d)

while

17.

Values that are used to end loops are referred to as ___ values.

a)

iterator

b)

sentinel

c)

break

d)

accumulator

18.

In a loop, the ___ read is used to prepare or set up the loop.

a)

sentinel

b)

accumulator

c)

priming

d)

initialization

19.

In a flowchart, the repetition symbol has ___ flowline(s) leading out of the symbol.

a)

one

b)

two

c)

three

d)

four

20.

When coding the while statement in C++, the loop condition must be a(n) ___ expression.

a)

arithmetic

b)

relational

c)

logical

d)

Boolean

21.

You create a statement block by enclosing the statements in a set of ___.

a)

()

b)

[]

c)

{}

d)

<>

22.

Usually, you can stop a program that contains an infinite loop by press___.

a)

Ctrl+e

b)

Ctrl+c

c)

Ctrl+s

d)

Ctrl+x

23.

A(n) ___ is a numeric variable variable used for counting something, such as the number of employees paid in a week.

a)

sentinel

b)

iterator

c)

counter

d)

accumulator

24.

The most common use for the for statement is to code protest loops whose processing is controlled by a(n) ___.

a)

flag

b)

counter

c)

accumulator

d)

sentinel

25.

The for statement begins with the for clause, which contains___ arguments separated by semicolons.

a)

two

b)

three

c)

four

d)

many