wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Long Test Part 1 - Conditional Statements_IT1107

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

What is the purpose of control flow in Python?

a)

To store variables

b)

To perform mathematical operations

c)

To choose which instructions run based on conditions

d)

To repeat code

2.

Which statement runs only when a condition is True?

a)

Else

b)

Elif

c)

If

d)

Match

3.

Which statement executes when the condition in an if statement is False?

a)

continue

b)

else

c)

elif

d)

match

4.

What does the elif keyword mean?

a)

Else if

b)

Else finally

c)

End line if

d)

Additional loop

5.

How many conditions can an elif statement check?

a)

Only one

b)

Unlimited

c)

Only two

d)

Only three

6.

Which operator returns True only when both conditions are True?

a)

or

b)

not

c)

and

d)

not equal

7.

Which operator returns True if at least one condition is True?

a)

And

b)

Or

c)

Not

d)

Equal

8.

Which operator reverses a condition?

a)

invert

b)

not

c)

and

d)

!=

9.

What would not False evaluate to?

a)

False

b)

True

c)

Equal

d)

0

10.

Which scenario is best for match-case?

a)

Complex boolean conditions

b)

Comparing a variable to many possible fixed values

c)

Nested while loops

d)

Mathematical operations

11.

What symbol is used in match-case to handle unmatched patterns?

a)

*

b)

?

c)

_

d)

Default

12.

What does this match-case line mean?

case "online" | "active":

a)

Both must match

b)

Both are ignored

c)

Error

d)

Either "online" or "active" matches

13.

Which keyword begins a match-case block?

a)

switch

b)

match

c)

case

d)

If

14.

In Python, decision-making is important because it:

a)

Allows dynamic execution based on conditions

b)

Controls program output

c)

Stores values

d)

Speeds up the CPU

15.

Which is the correct if statement?

a)

if x > 5:

b)

if (x > 5)

c)

if x > 5 then:

d)

if x > 5 do:

16.

What will the expression 18 >= 18 return?

a)

17

b)

18

c)

False

d)

True

17.

Which is a valid use of logical operators?

a)

if age and 18:

b)

if age == 18 && licensed:

c)

if age >= 18 and licensed:

d)

if age >= 18 or licensed ==

18.

What happens if all if and elif conditions are False?

a)

The program stops

b)

Python crashes

c)

The else block runs

d)

Nothing happens

19.

Which is more readable for many fixed values?

a)

if-else

b)

while loops

c)

match-case

d)

try-except

20.

Which code will print “You can board” if either variable is True?

a)

if ticket and passport:

b)

if not ticket:

c)

if ticket == passport:

d)

if ticket or passport:

21.

What does the code output?

a)

Adult

b)

Minor

c)

Error

d)

Nothing

22.

What will be printed when this code is executed?

a)

Valid

b)

Invalid

c)

10

d)

Error

23.

What is the output?

a)

Go outside

b)

Stay inside

c)

Error

d)

True

24.

What will be printed?

a)

0

b)

Error

c)

False value

d)

True value

25.

What will be displayed?

a)

Minor

b)

Just adult

c)

Adult

d)

Error

26.

What does this print?

a)

Allowed

b)

Denied

c)

Error

d)

Nothing

27.

What will the output be?

a)

Available

b)

Not available

c)

Unknown

d)

Error

28.

What will be the output when executed?

a)

Odd

b)

Even

c)

True

d)

False

29.

What will be printed?

a)

A

b)

Error

c)

B

d)

C

30.

What is the final output?

a)

Start

b)

End

c)

Regular day

d)

Sunday