wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Chapter 7: Loops

Total questions: 11

Worksheet time: 9mins

Name
Class
Date
1.

Running the same code multiple times is called...

a)

repetition

b)

being on a roll

c)

iteration

d)

redundant

2.

Look at the following loop:


The expression in the parentheses is called the ...

a)

condition

b)

return type

c)

body

d)

object

3.

Look at the following code:


The statements in braces are called the...

a)

condition

b)

output

c)

parameters

d)

body

4.

Which of the following is the increment operator?

a)

+

b)

++

c)

**

d)

--

5.

Which of the following is the decrement operator?

a)

**

b)

-

c)

--

d)

++

6.

Look at the following for loop. How many times will this run?

a)

5

b)

4

c)

3

d)

2

7.

What is the output of the following loop?

a)

$$$$$$

b)

$$$$$

c)

$$$$

d)

$$

8.

Which of the following statements decrements the variable x by 1. Choose all that apply.

a)

x--;

b)

x = x -1;

c)

x == x - 1;

d)

x++;

9.

Which of the following statements increments the variable i by 2. Select all that apply.

a)

i = i + 2;

b)

i += 2;

c)

i == i + 2;

d)

i++;

10.

If a loop tests a condition before the beginning of each pass through the loop, it is a

a)

pretest loop

b)

posttest loop

c)

before check

d)

secure interface

11.

Which loop is a posttest loop?

a)

the for loop

b)

the while loop

c)

the do-while loop

d)

the enhanced for loop