wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Selection in Python

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Which one is a valid example of selection?

a)

if

b)

print

c)

x = 1

d)

=

2.

What is else if denoted as in Python?

a)

elif

b)

elseif

c)

eli

d)

if:

3.

Which one is NOT a comparison operator

a)

!=

b)

=

c)

==

d)

<=

4.

a = 1

if a != 1:

Is this true or false?

a)

True

b)

False

5.

What will this code print?

Type and enter your answer

(a)  

6.

What will this code output when the data you enter is 100?

a)

Syntax error

b)

target hit

c)

target missed

d)

Nothing (null)

7.

Select all the correct logical operators

a)

and

b)

for

c)

or

d)

not

8.

2 == 3

a)

True

b)

False

9.

21 <= 20

a)

True

b)

False

10.

What will this code output if I enter the integer 9999

a)

syntax error

b)

9999

c)

You cannot play games

d)

You can play games

11.

What will this code output?

a)

equal

b)

not equal

c)

10

d)

Syntax error

12.

Enter the number of comparison operators in this code

(a)  

13.

Select the relevant description for else if

a)

We would use else if for more than two selection conditions.

b)

We would use else if for only one selection condition

c)

We would use else if for calculating the modulus of a division

d)

We would use else if as a type of iteration

14.

Type the LINE number that has a syntax error

(Line number is on the left of the code snippet)

(a)  

15.

What will this code output?

a)

access granted

b)

access denied

c)

syntax error

d)

password