System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 49
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
Correct Answer:
D
Chapter: 49
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
Correct Answer:
A
Chapter: 49
Q1023:
The syntax to catch exceptions in Python uses the keyword ________.
A. except
B. finally
C. try
D. else
Correct Answer:
B
Chapter: 49
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
Correct Answer:
A
Chapter: 49
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
Correct Answer:
C
Chapter: 49
Q1026:
Which block will execute last in a Python try-except-else-finally sequence?
A. try
B. except
C. else
D. finally
Correct Answer:
D
Chapter: 50
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
Correct Answer:
C
Chapter: 50
Q1028:
Returning EXCEPTION_CONTINUE_EXECUTION (-1) causes the program to ________.
A. resume execution
B. terminate execution
C. call another handler
D. ignore exception
Correct Answer:
A
Chapter: 50
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
Correct Answer:
B
Chapter: 50
Q1030:
What does the function ResetVars do in the example provided?
A. Handle exception
B. Reset global variables
C. Log error
D. Clean memory
Correct Answer:
B
Chapter: 50
Q1031:
If Eval_Exception never returns EXCEPTION_EXECUTE_HANDLER (1), then the except block will ________.
A. always execute
B. never execute
C. only execute on overflow
D. execute after filter
Correct Answer:
B
Chapter: 50
Q1032:
The conditional operator in C can be used in filter expressions to ________.
A. perform conditional evaluation
B. perform bitwise operations
C. execute multiple statements
D. return a value
Correct Answer:
A
Chapter: 50
Q1033:
The comma operator in C evaluates expressions and returns ________.
A. the last expression
B. the first expression
C. the sum of expressions
D. nothing
Correct Answer:
A
Chapter: 50
Q1034:
The filter expression is evaluated ________ the except block executes.
A. before
B. after
C. during
D. never
Correct Answer:
A
Chapter: 50
Q1035:
Returning EXCEPTION_EXECUTE_HANDLER (1) in a filter causes control to be passed to ________.
A. the except block
B. the finally block
C. the try block
D. the calling function
Correct Answer:
A
Chapter: 50
Q1036:
In the example, which exception types trigger ResetVars function?
A. Integer overflow
B. Floating-point overflow
C. Null pointer dereference
D. Array index out of bounds
Correct Answer:
B
Chapter: 50
Q1037:
The except block in the example is ________.
A. empty
B. handling exceptions
C. logging errors
D. resetting variables
Correct Answer:
A
Chapter: 50
Q1038:
Which of these is NOT a typical return value of a filter expression?
A. EXCEPTION_CONTINUE_EXECUTION
B. EXCEPTION_EXECUTE_HANDLER
C. EXCEPTION_CONTINUE_SEARCH
D. EXCEPTION_RETRY
Correct Answer:
D
Chapter: 50
Q1039:
The EXCEPTION_CONTINUE_SEARCH return value means the system should ________.
A. search for another handler
B. stop execution
C. continue execution
D. restart handler
Correct Answer:
A
Chapter: 50
Q1040:
What does the filter expression do in Windows SEH?
A. Handles exceptions
B. Filters exceptions
C. Resumes execution
D. Terminates program
Correct Answer:
B