System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 60
Q1241:
What happens if Handler returns FALSE?
A. Handler restarts
B. Event is ignored
C. Next handler is called
D. Program terminates
Correct Answer:
C
Chapter: 60
Q1242:
Which control signal is triggered when the console is closed?
A. CTRL_LOGOFF_EVENT
B. CTRL_CLOSE_EVENT
C. CTRL_C_EVENT
D. CTRL_BREAK_EVENT
Correct Answer:
B
Chapter: 60
Q1243:
The handler routine runs in a(n) _______ thread.
A. main
B. independent
C. parallel
D. shared
Correct Answer:
B
Chapter: 60
Q1244:
Signals apply to the whole process, while exceptions apply to _______.
A. all threads
B. the handler only
C. a single thread
D. the whole system
Correct Answer:
C
Chapter: 60
Q1245:
The loop in the main function will stop executing when ______.
A. the system reboots
B. exitFlag becomes TRUE
C. the user presses Enter
D. main ends
Correct Answer:
B
Chapter: 60
Q1246:
Console control handlers are used to detect ______.
A. compiler errors
B. console related events
C. keyboard shortcuts
D. network interrupts
Correct Answer:
B
Chapter: 60
Q1247:
If Handler is NULL and Add is TRUE in SetConsoleCtrlHandler, what happens?
A. The console shuts down
B. The event is logged
C. Ctrl-C is ignored
D. Error occurs
Correct Answer:
C
Chapter: 60
Q1248:
The value of dwCtrlType determines ______.
A. thread priority
B. loop count
C. control signal type
D. memory location
Correct Answer:
C
Chapter: 60
Q1249:
The system invokes the handler in which order?
A. reverse order of registration
B. random order
C. same order as added
D. default order
Correct Answer:
A
Chapter: 60
Q1250:
Sleep(4000) delays execution for ______.
A. 4 milliseconds
B. 4 minutes
C. 4 seconds
D. 400 seconds
Correct Answer:
C
Chapter: 60
Q1251:
Signal handlers can return TRUE to indicate ______.
A. an exception
B. termination
C. completion of the task
D. the signal was ignored
Correct Answer:
D
Chapter: 60
Q1252:
The main program prints a message before ______.
A. initialization
B. adding the handler
C. terminating the loop
D. resetting variables
Correct Answer:
C
Chapter: 60
Q1253:
_tprintf is used to ______.
A. beep the system
B. exit the thread
C. display formatted output
D. restart console
Correct Answer:
C
Chapter: 60
Q1254:
Handlers handle console signals such as Ctrl-C and ______.
A. Ctrl-D
B. Ctrl-Z
C. Ctrl-Break
D. Ctrl-Alt-Del
Correct Answer:
C
Chapter: 60
Q1255:
If the handler manages the event properly, it returns ______.
A. NULL
B. 1
Correct Answer:
B
Chapter: 60
Q1256:
CTRL_SHUTDOWN_EVENT indicates that the user is trying to ______.
A. log off
B. restart
C. log in
D. shut down
Correct Answer:
D
Chapter: 60
Q1257:
The handler modifies exitFlag in order to ______.
A. exit the program
B. continue the loop
C. start the handler
D. ignore the signal
Correct Answer:
A
Chapter: 60
Q1258:
Beep(1000, 250) plays a sound at 1000 Hz for ______.
A. 250 seconds
B. 250 ms
C. 1000 seconds
D. 1 second
Correct Answer:
B
Chapter: 60
Q1259:
The console handler is written using the keyword ______.
A. main
B. HANDLE
C. BOOL WINAPI
D. static BOOL WINAPI
Correct Answer:
D
Chapter: 60
Q1260:
Sleep(4750) in the main loop allows for ______.
A. error detection
B. beeping
C. delay in beeping
D. loading libraries
Correct Answer:
C