System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Multiple Choice Questions
Q1071: Which of the following runs regardless of whether an exception occurred or not?
- A: try
- B: except
- C: finally
- D: else
View Answer
D
Q1072: In the Python exception handling sequence, the correct order of blocks is ________.
- A: try, except, else, finally
- B: try, else, except, finally
- C: except, try, finally, else
- D: finally, try, except, else
View Answer
A
Q1073: When an exception is raised in the try block, Python looks for a matching ________ block.
- A: else
- B: except
- C: finally
- D: try
View Answer
B
Q1074: If no exception occurs in the try block, the except blocks are ________.
- A: executed
- B: skipped
- C: partially executed
- D: ignored
View Answer
B
Q1075: Which block is mandatory in Python exception handling?
- A: try
- B: except
- C: else
- D: finally
View Answer
A
Q1076: The keyword used to catch all exceptions is ________.
- A: except
- B: try
- C: finally
- D: else
View Answer
A
Q1077: When an exception is caught in except block, the program ________.
- A: terminates
- B: continues execution
- C: with error warning
- D: restarts
View Answer
B
Q1078: If you want to execute cleanup code regardless of exceptions, you should use the ________ block.
- A: except
- B: finally
- C: else
- D: try
View Answer
B
Q1079: You want to catch both ExceptionI and ExceptionII separately, you should use ________.
- A: two try blocks
- B: two else blocks
- C: two except blocks
- D: two finally blocks
View Answer
C
Q1080: Code inside the try block is executed ________.
- A: before exception handling
- B: only if no exceptions occur
- C: always
- D: until exception occurs
View Answer
D