wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python - Selection (IF statements)

Total questions: 17

Worksheet time: 8mins

Name
Class
Date
1.

In Python, When we want to test multiple conditions we use elif statement.

a)

True

b)

False

2.

In Python, the selection statements are also known as decision making statements or branching statements.

a)

True

b)

False

3.

1==0

a)

True

b)

False

4.

5 >= 5

a)

True

b)

False

5.

How do you write an 'else if' in Python?

a)

elseif

b)

elif

c)

elife

d)

else

6.

what does != mean

a)

not

b)

swap value

c)

not equal

d)

equal

7.

What will this code print?

a)

access denied

b)

access granted

c)

error

d)

password

8.

The character that must be at the end of the line for if?

a)

:

b)

;

c)

.

d)

,

9.

What will the code do?

a)

nothing

b)

display Hello Bob

c)

display I don't know you

d)

display Hello

10.

To add selection in to a program, what would you use?

a)

An 'int' command

b)

A 'while' loop

c)

An 'If' statement

d)

a 'print' command

11.

If the user enters 60, what is the output?

a)

You are old!

b)

You are middle-aged!

c)

You are young!

d)

Error message

12.
The correct way to write a variable in Python?
a)
myVariable = 10
b)
my Variable = 10
c)
myVariable is 10
d)
myVariable: 10
13.
In python the ' INTEGER data type' can be defined as...?
a)
holds alphanumeric data as text
b)
holds whole numbers
c)
holds numbers with a decimal point
d)
holds either ‘true’ or ‘false’
14.
In python the ' STRING data type' can be defined as...?
a)
holds alphanumeric text
b)
hold whole numbers
c)
holds numbers with a decimal point
d)
holds either a true or false value
15.
When you have an error in your code what is the term to summarise finding and fixing that error?
a)
Error checking
b)
Debugging
c)
Syntax finder
d)
Error finder
16.

What will be output from this code?

a)

Well Done

b)

Excellent Work

c)

Distinction

d)

Hard Luck

17.

The data type of mynum is int.

What is the missing word that lets us take input as data type int?

a)

str

b)

integer

c)

int

d)

float