wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python IF statements Part 4

Total questions: 20

Worksheet time: 12mins

Name
Class
Date
1.
This operator means that one value is the same as the other value
a)
==
b)
!=
c)
>
d)
<
2.
This operator means that one value is not equal to another value
a)
==
b)
<=
c)
>=
d)
!=
3.
How many choices are possible when using a single if-else statement?
a)
1
b)
2
c)
3
d)
4
4.

The "If" Statement is an example of a _________________

a)

Correctional Statement

b)

Competitive Statement

c)

Conditional Statement

d)

Inquisitive Statement

5.

How many "if" statements can a single program have?

a)

<10

b)

<20

c)

<30

d)

As many as is needed

6.

Which of these can be paired with an "if" statement to represent other outcomes of a scenario?

a)

or

b)

else

c)

but

d)

sheboygan

7.

How many "else" statements can you pair with a single "if" statement

a)

1

b)

<10

c)

<20

d)

As many as is needed.

8.

How many "else if" links can you have in an "if/else" chain?

a)

<10

b)

<20

c)

<30

d)

As many as is needed to represent the situation

9.

What are booleans?

a)
Numbers between 1 and 10
b)
Strings of text
c)
Arrays of values
d)
True or false values
10.

What is the output to the python code?
X = 5

Y = 5

print(X == Y)

a)
Error
b)
True
c)
None
d)
False
11.

Which character must be at the end of the line for if?

a)

:

b)

;

c)

.

d)

{

12.

Pieces of code that only run "under certain conditions":

a)

conditional statements

b)

control flow statments

c)

syntax

d)

variables

13.

What is elif in Python?

a)

eliminate if

b)

else if

c)

A person's name

d)

False

14.

What part of an if statement should be indented?

a)

All of it

b)

The statements within it

c)

the first line

d)

the lines within the brackets

15.

If x = 5 and y = 10, evaluate the following:


(x != 5 || y < 10)

a)

True

b)

False

16.

If x = 5 and y = 10, evaluate the following:


!(x > y) && (y != 12)

a)

True

b)

False

17.

If x = 5 and y = 10, evaluate the following:


!((x > y) && (y != 12))

a)

True

b)

False

18.

If x = 5 and y = 10, evaluate the following:


((x == 5) || (y == 9))

a)

True

b)

False

19.

If x = 5 and y = 10, evaluate the following:


((x != 5) || (y == 9))

a)

True

b)

False

20.

If x = 5 and y = 10, evaluate the following:


! (x > 5 || y < 10)

a)

True

b)

False