System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Multiple Choice Questions
Q1021: You want to run cleanup code after a try block whether an error occurred or not. Which block do you use?
- A: try
- B: except
- C: else
- D: finally
View Answer
D
Q1022: If the code in try block succeeds without errors, which blocks execute?
- A: try, else, finally
- B: try, except, finally
- C: except, else
- D: finally, except
View Answer
A
Q1023: The syntax to catch exceptions in Python uses the keyword ________.
- A: except
- B: finally
- C: try
- D: else
View Answer
B
Q1024: The block that executes if an error occurs and is used to catch specific exceptions is called ________.
- A: except
- B: try
- C: finally
- D: else
View Answer
A
Q1025: The else block in Python exception handling is executed when the try block ________.
- A: completes without exception
- B: throws exception
- C: is skipped
- D: is nested
View Answer
C
Q1026: Which block will execute last in a Python try-except-else-finally sequence?
- A: try
- B: except
- C: else
- D: finally
View Answer
D
Q1027: An exception filter in Windows can be used to ________ before deciding how to handle an exception.
- A: handle the exception
- B: continue execution
- C: clean up the problem
- D: ignore the exception
View Answer
C
Q1028: Returning EXCEPTION_CONTINUE_EXECUTION (-1) causes the program to ________.
- A: resume execution
- B: terminate execution
- C: call another handler
- D: ignore exception
View Answer
A
Q1029: Which of the following is a recommended approach when a filter expression needs to perform complex evaluation?
- A: Use inline code
- B: Use a function call
- C: Use a loop
- D: Use global variables
View Answer
B
Q1030: What does the function ResetVars do in the example provided?
- A: Handle exception
- B: Reset global variables
- C: Log error
- D: Clean memory
View Answer
B