wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

conditional and iterative statements

Total questions: 10

Worksheet time: 8mins

Name
Class
Date
1.
a)
12  17   22
b)
5
c)
12
d)
5  10
2.
a)
12  9  6  3  0
b)
0  3  6  9  12
c)
9  6  3  0
d)
0  3  6  9
3.

The program above

a)

prints all the odd numbers between 1 and 20

b)

prints all even numbers between 1 and 20

c)

print all the odd numbers between 1 and 21

d)

prints all the even numbers between 1 and 21

4.

The equivalent of the above for loop using the while syntax would be

a)
b)
c)
d)
5.

How many times will 1 be printed

a)

3

b)

4

c)

5

d)

6

6.

for i in 100 :

print ( i )

a)

Syntax error

b)

prints numbers 0 to 100

c)

prints numbers 1 to 100

d)

prints numbers 0 to 99

e)

prints numbers 1 to 99

7.

What does this program print

a)

2 + 2 = 4

4 + 4 = 8

8 + 8 = 16

16 + 16 = 32

32 + 32 = 64

b)

2 + 2 = 4

2 + 2 = 4

2 + 2 = 4

2 + 2 = 4

2 + 2 = 4

c)

2 + 2 = 4

2 + 4 = 6

2 + 6 = 8

2 + 8 = 10

2 + 10 = 12

d)

2 + 2 = 4

2 + 2 = 4

2 + 2 = 4

2 + 2 = 4

e)

2 + 2 = 4

2 + 4 = 6

2 + 6 = 8

2 + 8 = 10

8.
What is printed when this program is run:
days = 5 
if days > 6:  
   print(“Month”)

else:  
   print(“Week”)
a)
Month
b)
Week
c)
Day
d)
4
9.
What letter will be printed on the screen after running this code:

team = “Manchester United”
letter = name[5]
print(letter)
a)
M
b)
d
c)
e
d)
Nothing prints
10.
What will be printed after running this FOR loop:

for number in range(6):
 
    print(number)
a)
The number 6 
b)
The numbers 0 - 5
c)
The number 5
d)
The numbers 1 - 6