Font size
WorksheetsPPL (QUIZ 4) Programming Control Structures
Total questions: 30
Worksheet time: 23mins
A programming structure that allows decision-making based on conditions.
(Type your answer in ALL SMALL LETTERS) Do not forget to submit your answer.
(a)
A programming construct that enables a set of instructions to be executed repeatedly based on a condition.
(Type your answer in ALL SMALL LETTERS) Do not forget to submit your answer.
(a)
A mechanism that allows a program to handle runtime errors gracefully.
(Type your answer in ALL SMALL LETTERS) Do not forget to submit your answer.
(a)
The process of determining the value of an expression following precedence rules.
Looping Constructs
Exception Handling
Expression Evaluation
Control Structure
The keyword used in Python to raise an exception manually.
throw
finally
raise
except
Which loop executes at least once before checking the condition?
(Type your answer in ALL SMALL LETTERS) Do not forget to submit your answer.
(a)
What is the default control structure used in programming?
Selection
Looping
Sequence
Decision
The part of the exception handling mechanism that executes no matter what.
finally
except
throw
raise
Which type of control structure involves loops?
(Type your answer in ALL SMALL LETTERS) Do not forget to submit your answer.
(a)
Which type of statement allows branching in the flow of execution?
(Type your answer in ALL SMALL LETTERS) Do not forget to submit your answer.
(a)
Which of the following is NOT a type of control structure?
Sequential
Decision-making
Looping
Recursion
What is the result of the following expression in Python? print(10 + 5 * 2)
30
20
25
15
Which loop is best used when the number of iterations is known?
(Type your answer in ALL SMALL LETTERS) Do not forget to submit your answer.
(a)
What keyword is used to exit a loop immediately?
(Type your answer in ALL SMALL LETTERS) Do not forget to submit your answer.
(a)
Which statement is used to skip the current iteration and move to the next one?
break
pass
continue
return
What will be printed by the following Python code? x = 10 if x > 5: print("Greater") else: print("Smaller")
Greater
Smaller
Error
None of the above
What type of error does exception handling prevent?
Syntax Error
Runtime Error
Logical Error
Compilation Error
In Python, how do you handle a division by zero error?
Using a try-except block
Using an if-else statement
Using a for loop
Using a while loop
What does the finally block do in exception handling?
Runs only if an exception occurs
Runs only if no exception occurs
Runs whether or not an exception occurs
Does nothing
What does the pass statement do in Python?
Terminates a loop
Skips a loop iteration
Does nothing and serves as a placeholder
Raises an error
A for loop is typically used when the number of iterations is known beforehand.
TRUE
FALSE
The break statement skips the current iteration and moves to the next one.
TRUE
FALSE
The finally block in exception handling is executed only if an exception occurs.
TRUE
FALSE
Exception handling is used to fix syntax errors in the program.
TRUE
FALSE
A while loop will always execute at least once, even if the condition is false.
TRUE
FALSE
The continue statement is used to exit the loop immediately.
TRUE
FALSE
Exception handling helps prevent runtime errors from crashing the program.
TRUE
FALSE
A try-except block allows a program to recover from certain errors.
TRUE
FALSE
The raise keyword is used to manually trigger an exception.
TRUE
FALSE
In Python, pass is a placeholder that does nothing when executed.
TRUE
FALSE
