Skip to main content

System Programming MCQs with Answers

Practice important System Programming MCQs with answers and explanations.

Chapter: 56
Q1121:
The keyword "finally" is used to define the ________ in a termination handler.
A. guarded body
B. termination block
C. try block
D. catch block
Correct Answer: B
Chapter: 56
Q1122:
When a thread leaves a guarded body normally, the termination block is ________.
A. executed
B. skipped
C. paused
D. restarted
Correct Answer: A
Chapter: 56
Q1123:
Termination handlers cannot catch or handle the actual exception, they only ________.
A. clean up after control flow leaves
B. ignore errors
C. prevent exceptions
D. throw new exceptions
Correct Answer: A
Chapter: 57
Q1124:
Termination handlers help programs become more ________.
A. efficient
B. robust
C. complex
D. unresponsive
Correct Answer: B
Chapter: 57
Q1125:
Termination handlers simplify recovery from ________.
A. errors and exceptions
B. memory leaks
C. syntax errors
D. network failures
Correct Answer: A
Chapter: 57
Q1126:
Termination handlers help ensure ________ and file locks are freed.
A. resources
B. memory
C. connections
D. variables
Correct Answer: A
Chapter: 57
Q1127:
In the code, an invalid handle is checked by comparing with ________.
A. NULL
B. INVALID_HANDLE_VALUE
D. -1
Correct Answer: B
Chapter: 57
Q1128:
If the handle is invalid, the function ________ is called.
A. ReportError
B. ReportException
C. HandleException
D. LogError
Correct Answer: B
Chapter: 57
Q1129:
GetFileSizeEx is used to retrieve the ________ of a file.
A. name
B. size
C. type
D. permissions
Correct Answer: B
Chapter: 57
Q1130:
The condition fsize.HighPart > 0 indicates that the file is ________.
A. too small
B. too large
C. read-only
D. locked
Correct Answer: B
Chapter: 57
Q1131:
The logical OR (||) in if(!GetFileSizeEx(hIn, &fsize) || fsize.HighPart > 0) means the exception is reported if the file size is invalid or ________.
A. too large
B. too small
C. missing
D. read-only
Correct Answer: A
Chapter: 57
Q1132:
The _T macro in _T("File is Too Large") is used for ________.
A. string encoding
B. error handling
C. file locking
D. debugging
Correct Answer: A
Chapter: 57
Q1133:
Termination handlers run when the control flow leaves the guarded body normally or ________.
A. abnormally
B. after a delay
C. only on error
D. before function call
Correct Answer: A
Chapter: 57
Q1134:
The function ReportException reports ________ detected during file operations.
A. exceptions
B. errors
C. success messages
D. warnings
Correct Answer: B
Chapter: 57
Q1135:
If GetFileSizeEx fails, the program reports the file as ________.
A. too large
B. unreadable
C. locked
D. too small
Correct Answer: A
Chapter: 57
Q1136:
The example code is written in ________ language.
A. C/C++
B. Python
C. Java
D. JavaScript
Correct Answer: A
Chapter: 57
Q1137:
In robust programs, termination handlers reduce the risk of ________.
A. resource leaks
B. syntax errors
C. memory allocation
D. network delays
Correct Answer: A
Chapter: 57
Q1138:
The variable fsize is a structure that holds the file size in ________ parts.
A. one
B. two
C. three
D. four
Correct Answer: B
Chapter: 57
Q1139:
The check for (hin == INVALID_HANDLE_VALUE) is necessary to prevent ________.
A. using invalid handles
B. calling ReportException
C. reading large files
D. opening files
Correct Answer: A
Chapter: 57
Q1140:
Termination handlers and exception handlers differ in that termination handlers execute on both normal and abnormal exits, while exception handlers only execute on ________.
A. abnormal exits
B. normal exits
C. both
D. none
Correct Answer: A

Test Your Knowledge

Take a timed quiz on System Programming

🚀 Start Quiz Now