wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Chapter 4: Loops

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

A control structure that causes a statement or group of statements to repeat as many times as necessary is known as a(n) _____.

a)

loop

b)

operator

c)

counter

d)

sequence

2.

A _________ loop uses a true/false condition to control the number of repetitions

a)

count-controlled

b)

condition-controlled

c)

situation-controlled

d)

prequalified

3.

A _________ loop uses a true/false condition to control the number of repetitions

a)

count-controlled

b)

condition-controlled

c)

situation-controlled

d)

prequalified

4.

A single execution of the statements in the body of the loop is called a(n) _____.

a)

accumulation

b)

iteration

c)

range

d)

control

5.

A while loop tests its expression:

a)

once, during initialization

b)

before each iteration

c)

after each iteration

d)

inside the loop

6.

How many times will ‘Hello World’ be printed in the following code?

a)

0

b)

1

c)

10

d)

an infinite number of times

7.

An infinite loop repeats until the program is

a)

replicated

b)

debugged

c)

interrupted

d)

recompiled

8.

Assume the variable upper_limit is assigned the value 50. How many times will the following for loop iterate?

a)

49

b)

50

c)

0

d)

51

9.

What will the code display?

a)

10

b)

15

c)

20

d)

320

10.

What sequence of numbers will the following code display?

a)

100

99

...

0

b)

99

98

...

1

c)

100

99

...

1

d)

99

98

...

0