wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

pyhthon condition statement

Total questions: 10

Worksheet time: 1hrs 3mins

Name
Class
Date
1.

In a Python program, what would be the ending value of total in the WHILE LOOP code?

a)

0

b)

5

c)

2

d)

20

2.

In a Python program, what would be the ending value for y in the WHILE LOOP code?

a)

5

b)

51

c)

10

d)

3

3.
A loop repeated if the condition is true / false
a)
While loop
b)
For loop
c)
Repeat loop
d)
If...else
4.
Loop executed a fixed number of times with a built-in-counter (creating a counter variable is unnecessary).
a)
While loop
b)
For loop
c)
Repeat loop
d)
If...else
5.
In programming, what is iteration?
a)
The repetition of steps within a program
b)
The order in which instructions are carried out
c)
A decision point in a program
d)
Testing a program to make sure it works
6.
a)
5
4
3
2
1
b)
4
3
2
1
0
c)
5  4  3  2  1
d)
4  3  2  1  0
7.

What will this code do?

a)

Print Numbers 1-11

b)

Print Numbers 1-10

c)

Print Numbers 2-10

d)

Print Error

8.

What will be the output of this code?

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,2,4,6,8,10

c)

2,4,6,8,10,12

d)

2,4,6,8,10

9.

Which of these will allow me to count from 0-20 in steps of 5?

a)

for x in range(0,20):

print(x)

b)

while x = (0,20,5):

print(x)

c)

for x in range(0,21,5):

print(x)

d)

for x in range(0,21,5):

print(y)

10.

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