wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Loops

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

To repeat a fixed number of times use a

a)

while loop

b)

if loop

c)

for loop

d)

indentation

2.

To repeat until a particular condition is true use

a)

while loop

b)

if loop

c)

for loop

d)

indentation

3.

 The character that must be at the end of the line for if, while, for etc.

a)

;

b)

+

c)

\;

d)

:

4.

How many times does the following program print the word ‘computer’:

word= "computer"  

for num in range(1,6):     

print(word)

a)

1

b)

5

c)

6

d)

0

5.

In programming, what is iteration?

a)

The repetition of steps within a program

b)

A decision point in a program

c)

The order in which instructions are carried out

d)

Testing a program to make sure it works

6.

Why is iteration important?

a)

It determines the order in which instructions are carried out

b)

It allows multiple paths through a program

c)

It allows code to be simplified by removing duplicated steps

d)

It ensures the code works correctly

7.

Which two statements are used to implement iteration?

a)

IF and WHILE

b)

FOR and WHILE

c)

ELSE and WHILE

d)

IF and ELSE

8.

 Which type of loop iterates until instructed otherwise?

a)

FOR loop

b)

Repeat-once loop

c)

WHILE loop

d)

A count-controlled loop

9.

The condition for a while loop to continue could include which of the following?

a)

While something equals something

b)

While something is greater than something

c)

While something is True

d)

All of these

10.

 Which of the following symbols is used in Python to mean "Equal to"?

a)

=

b)

==

c)

!=

d)

>=