wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2F-3 | Python Quiz | 25/11/2025

Total questions: 20

Worksheet time: 15mins

Name
Class
Date
1.

What is a conditional operator?

a)

An operator used for looping

b)

An operator that compares strings

c)

An operator that allows decision-making

d)

None of the above

2.

What does the following program output if a = 5 and b = 10?

a)

a is greater

b)

No output

c)

b is greater

d)

Error in the program

3.

How many if statements are needed to check if x is greater than both y and z?

a)

3

b)

2

c)

1

d)

None of the above

4.

What will be the output of this program?

a)

No output

b)

Error in the program

c)

Divisible

d)

None of the above

5.

What is the result of print(x > 5 and x < 10) when x = 7?

a)

False

b)

Error

c)

True

d)

None of the above

6.

Which of these statements checks if a number is positive and divisible by 3?

a)

x > 0 or x % 3 == 0

b)

x % 3 == 0 and x > 0

c)

x > 0 and x % 3 != 0

d)

x < 0 or x % 3 == 0

7.

Which logical operation is used in the following condition?

(a and b) or not c

a)

and only

b)
  • or only

c)

Both and and or

d)

Neither

8.

What are nested (вложенные) conditions?

a)

Conditions written inside loops

b)

Conditions written as functions

c)

Conditions placed inside other conditions

d)

Conditions used in mathematical formulas

9.

What will the following program output if x = 0?

a)

Positive

b)

Negative

c)

Zero

d)

Error

10.

How can you check if a number is divisible by 2, 3, and 5 using nested (вложенные) conditions?

a)

Use separate if statements for each condition

b)
  • Both

c)

Use nested if statements

d)

None

11.

What does the following program output?


print(len("Hello, world!"))

a)

13

b)

12

c)

Error

d)

None of the above

12.

What is the purpose of the 'else' statement in conditional programming?

a)

To execute code if the condition is false

b)

To define a function

c)

None of the above

d)

To repeat a block of code

13.

What will be the output of the following code if x = 10?

print(x < 5 or x > 8)

a)

None of the above

b)

Error

c)

False

d)

True

14.

How can you check if a variable 'num' is both even and greater than 10?

a)

num < 10 and num % 2 == 0

b)

num % 2 != 0 and num < 10

c)

num > 10 or num % 2 == 0

d)

num % 2 == 0 and num > 10

15.

What will the following code output if x = 5?

print(x == 5)

a)

True

b)

False

c)

None of the above

d)

Error

16.

What will be the output of the following code if a = 3 and b = 4?

print(a + b == 7)

a)

None of the above

b)

Error

c)

False

d)

True

17.

What will be the output of the following code if x = 15?

print(x % 5 == 0)

a)

Error

b)

True

c)

None of the above

d)

False

18.

What does the following program output?

print(type(3.14))

a)

int

b)

str

c)

float

d)

Error

19.

What will be the output of this program if y = -1?


if y < 0:
    print('Negative')
else:
    print('Positive')

a)

No output

b)

Error

c)

Negative

d)

Positive

20.

How can you check if a variable 'num' is odd?

a)

num < 0

b)

num % 2 == 0

c)

num % 2 != 0

d)

num > 0