wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Variables- Conditional-Looping reviews

Total questions: 18

Worksheet time: 28mins

Name
Class
Date
1.

What do we use variables for?

a)

To store data

b)

Print data

c)

Produce functions

2.

To get the users input what function do we use?

a)

input

b)

input<>

c)

input()

d)

INPUT()

3.

What will be printed to the screen?

a)

5 + John

b)

Syntax error - you cannot add str and int together

c)

John

d)

JohnJohnJohnJohnJohn

4.

Num = 90

Num = 20

print(Num)

a)

90

b)

4.5

c)

20

d)

1800

5.

In the following code, what is happening?

foo = "bar"

a)

A variable named foo is being created, with a value of "bar"

b)

A variable named bar is being created, with a value of "foo"

6.

In the following code, what type of variable is being created?

foo = "bar"

a)

Integer

b)

Float

c)

String

7.

The ‘else’ statement is optional in Python

a)

TRUE

b)

FALSE

8.

The code inside ‘If’ statement is executed only once

a)

FALSE

b)

TRUE

9.

What is the output?

a)

more than 7

b)

more than 23

c)

spam

d)

7

10.

The program above prints

a)

Numbers between 1 and 100 that are multiples of 5

b)

Numbers between 1 and 100

c)

Numbers between 1 and 100 divisible by 5

d)

Numbers between 1 and 101 that are multiples of 5

11.

The program above prints the sum of

a)

all odd numbers less than 100

b)

all even numbers less than 100

c)

all numbers less than 100

12.
a)
5
4
3
2
1
b)
4
3
2
1
0
c)
5  4  3  2  1
d)
4  3  2  1  0
13.
a)
10  8  6  4  2
b)
10
8
6
4
2
c)
2  4  6  8  10
d)
10  9  8  7  6  5  4  3  2  1
14.
a)
12  9  6  3  0
b)
0  3  6  9  12
c)
9  6  3  0
d)
0  3  6  9
15.
a)
12  17   22
b)
5
c)
12
d)
5  10
16.
a)
Welcome
b)
Try again!
c)
Error
d)
Enter your password
17.

 

 

Password

You want a password to protect your program, if the user enters the wrong password, the program will let them know. The program answer will be either “correct password” or “incorrect password”

Ps: use input function here

4 lines
18.

Rock / paper / scissors

Suppose Jack and Jill are playing rock paper scissors game.

The jack and Jill variables will have a choice of “rock” , “ scissors” or paper.

The input function have to be clear.

If Jack is a winner, print “ Jack wins”

If Jill is a winner, print “ Jill wins”

If they tie, print “tie” 

Ps: you can combine conditions using and / or

4 lines