NEW
Font size
WorksheetsLong Test Part 1 - Conditional Statements_IT1107
Total questions: 30
Worksheet time: 15mins
What is the purpose of control flow in Python?
To store variables
To perform mathematical operations
To choose which instructions run based on conditions
To repeat code
Which statement runs only when a condition is True?
Else
Elif
If
Match
Which statement executes when the condition in an if statement is False?
continue
else
elif
match
What does the elif keyword mean?
Else if
Else finally
End line if
Additional loop
How many conditions can an elif statement check?
Only one
Unlimited
Only two
Only three
Which operator returns True only when both conditions are True?
or
not
and
not equal
Which operator returns True if at least one condition is True?
And
Or
Not
Equal
Which operator reverses a condition?
invert
not
and
!=
What would not False evaluate to?
False
True
Equal
0
Which scenario is best for match-case?
Complex boolean conditions
Comparing a variable to many possible fixed values
Nested while loops
Mathematical operations
What symbol is used in match-case to handle unmatched patterns?
*
?
_
Default
What does this match-case line mean?
case "online" | "active":
Both must match
Both are ignored
Error
Either "online" or "active" matches
Which keyword begins a match-case block?
switch
match
case
If
In Python, decision-making is important because it:
Allows dynamic execution based on conditions
Controls program output
Stores values
Speeds up the CPU
Which is the correct if statement?
if x > 5:
if (x > 5)
if x > 5 then:
if x > 5 do:
What will the expression 18 >= 18 return?
17
18
False
True
Which is a valid use of logical operators?
if age and 18:
if age == 18 && licensed:
if age >= 18 and licensed:
if age >= 18 or licensed ==
What happens if all if and elif conditions are False?
The program stops
Python crashes
The else block runs
Nothing happens
Which is more readable for many fixed values?
if-else
while loops
match-case
try-except
Which code will print “You can board” if either variable is True?
if ticket and passport:
if not ticket:
if ticket == passport:
if ticket or passport:
What does the code output?
Adult
Minor
Error
Nothing
What will be printed when this code is executed?
Valid
Invalid
10
Error
What is the output?
Go outside
Stay inside
Error
True
What will be printed?
0
Error
False value
True value
What will be displayed?
Minor
Just adult
Adult
Error
What does this print?
Allowed
Denied
Error
Nothing
What will the output be?
Available
Not available
Unknown
Error
What will be the output when executed?
Odd
Even
True
False
What will be printed?
A
Error
B
C
What is the final output?
Start
End
Regular day
Sunday
