Font size
Worksheets2F-3 | Python Quiz | 25/11/2025
Total questions: 20
Worksheet time: 15mins
What is a conditional operator?
An operator used for looping
An operator that compares strings
An operator that allows decision-making
None of the above
What does the following program output if a = 5 and b = 10?
a is greater
No output
b is greater
Error in the program
How many if statements are needed to check if x is greater than both y and z?
3
2
1
None of the above
What will be the output of this program?
No output
Error in the program
Divisible
None of the above
What is the result of print(x > 5 and x < 10) when x = 7?
False
Error
True
None of the above
Which of these statements checks if a number is positive and divisible by 3?
x > 0 or x % 3 == 0
x % 3 == 0 and x > 0
x > 0 and x % 3 != 0
x < 0 or x % 3 == 0
Which logical operation is used in the following condition?
(a and b) or not c
and only
or only
Both and and or
Neither
What are nested (вложенные) conditions?
Conditions written inside loops
Conditions written as functions
Conditions placed inside other conditions
Conditions used in mathematical formulas
What will the following program output if x = 0?
Positive
Negative
Zero
Error
How can you check if a number is divisible by 2, 3, and 5 using nested (вложенные) conditions?
Use separate if statements for each condition
Both
Use nested if statements
None
What does the following program output?
print(len("Hello, world!"))
13
12
Error
None of the above
What is the purpose of the 'else' statement in conditional programming?
To execute code if the condition is false
To define a function
None of the above
To repeat a block of code
What will be the output of the following code if x = 10?
print(x < 5 or x > 8)
None of the above
Error
False
True
How can you check if a variable 'num' is both even and greater than 10?
num < 10 and num % 2 == 0
num % 2 != 0 and num < 10
num > 10 or num % 2 == 0
num % 2 == 0 and num > 10
What will the following code output if x = 5?
print(x == 5)
True
False
None of the above
Error
What will be the output of the following code if a = 3 and b = 4?
print(a + b == 7)
None of the above
Error
False
True
What will be the output of the following code if x = 15?
print(x % 5 == 0)
Error
True
None of the above
False
What does the following program output?
print(type(3.14))
int
str
float
Error
What will be the output of this program if y = -1?
if y < 0:
print('Negative')
else:
print('Positive')
No output
Error
Negative
Positive
How can you check if a variable 'num' is odd?
num < 0
num % 2 == 0
num % 2 != 0
num > 0
