System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Multiple Choice Questions
Q1011: The block that executes code regardless of the outcome of try and except blocks is called ________.
- A: try
- B: except
- C: else
- D: finally
View Answer
D
Q1012: In Python exception handling, which block is optional and used to clean up resources?
- A: try
- B: except
- C: else
- D: finally
View Answer
D
Q1013: The purpose of the try block is to ________.
- A: handle errors
- B: test code
- C: clean resources
- D: catch exceptions
View Answer
B
Q1014: The except block is executed when ________.
- A: an error occurs
- B: information is logged
- C: no error occurs
- D: processing finishes
View Answer
A
Q1015: The else block runs when ________.
- A: no exception occurs
- B: an exception occurs
- C: after finally block
- D: before try block
View Answer
A
Q1016: Finally block is always executed ________.
- A: after try and except blocks
- B: only on error
- C: only on success
- D: before except block
View Answer
A
Q1017: The finally block is useful for ________.
- A: cleaning up resources
- B: running alternative code
- C: skipping errors
- D: handling specific exceptions
View Answer
A
Q1018: What happens if no exception occurs in the try block and there is an else block?
- A: else block runs
- B: except block runs
- C: finally block skipped
- D: finally block runs
View Answer
C
Q1019: In Python, which block is guaranteed to execute even if an exception is raised and not handled?
- A: try
- B: except
- C: else
- D: finally
View Answer
D
Q1020: If an exception occurs and is handled, which blocks are executed?
- A: try, except, finally
- B: try, else, finally
- C: try, except, else
- D: except, else, finally
View Answer
A