wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python IF Statements

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Any statements inside an IF clause (section) can be executed multiple times.

a)

FALSE

b)

TRUE

2.

It is possible to execute both the (block of) statements under if and the else clauses at the same time.

a)

Yes

b)

No

3.

What is the output?

a)

True

b)

False

c)

condition1

d)

condition2

4.

Given the nested if-else below, what will be the value x when the code is executed successfully.

a)

0

b)

4

c)

2

d)

3

5.

This operator checks to see if one value is the same as the other value

a)

==

b)

!=

c)

>

d)

<

6.

What would be outputted here?

a)

Bigger than 2!

b)

Number is 5

c)

Bigger than 2!

Number is 5

d)

Nothing

7.

What would be outputted here?

a)

it divides by 7!

b)

it divides by 3!

c)

It divides by 7.

d)

It divides by 3.

8.

What will be outputted?

a)

number is bigger than 10

b)

nothing

c)

an error

d)

NUMBER IS BIGGER THAN 10

9.

What is the output?

a)

3

b)

3

7

c)

3

5

7

d)

7

10.

Which condition is a logic error (will not run properly)?

a)

x>=1 AND x<=100

b)

1<=x<=100

c)

1>x>100

d)

x<1 OR x>100