Skip to main content

System Programming MCQs with Answers

Practice important System Programming MCQs with answers and explanations.

Chapter: 59
Q1221:
Console signal handling is especially important for ______ applications.
A. background
B. console-based
C. web-based
D. GUI
Correct Answer: C
Chapter: 59
Q1222:
SetConsoleCtrlHandler allows developers to handle or ______ console signals.
A. print
B. redirect
C. process
D. ignore
Correct Answer: D
Chapter: 59
Q1223:
The handler function executes as part of a new ______ within the process.
A. block
B. thread
C. call
D. stack
Correct Answer: B
Chapter: 59
Q1224:
Signal handler chain follows which execution flow?
A. random
B. order of setup
C. reverse of setup
D. order of call
Correct Answer: C
Chapter: 59
Q1225:
If the handler returns TRUE, further handlers are ______.
A. skipped
B. continued
C. queued
D. reversed
Correct Answer: A
Chapter: 59
Q1226:
SetConsoleCtrlHandler is a part of which API set?
A. POSIX
B. Java
C. Win32
D. .NET
Correct Answer: C
Chapter: 60
Q1227:
What is the purpose of the SetConsoleCtrlHandler function?
A. To create GUI
B. To handle keyboard events
C. To handle console control events
D. To run the main function
Correct Answer: C
Chapter: 60
Q1228:
Which value must be passed to SetConsoleCtrlHandler to add a handler?
A. Handler, FALSE
B. NULL, FALSE
C. Handler, TRUE
D. NULL, TRUE
Correct Answer: C
Chapter: 60
Q1229:
What is the return type of a HandlerRoutine function?
A. VOID
B. INT
C. BOOL
D. CHAR
Correct Answer: C
Chapter: 60
Q1230:
The parameter of the HandlerRoutine function is of which data type?
A. DWORD
B. INT
C. BOOL
D. CHAR
Correct Answer: A
Chapter: 60
Q1231:
Which of the following is not a console control event?
A. CTRL_C_EVENT
B. CTRL_CLOSE_EVENT
C. CTRL_LOGON_EVENT
D. CTRL_SHUTDOWN_EVENT
Correct Answer: C
Chapter: 60
Q1232:
The console control handler is invoked when _______ occurs.
A. a syntax error
B. a logical exception
C. a console event
D. a variable overflow
Correct Answer: C
Chapter: 60
Q1233:
If SetConsoleCtrlHandler fails, what action does the program take?
A. Calls main again
B. Prints error message
C. Terminates automatically
D. Restarts the loop
Correct Answer: B
Chapter: 60
Q1234:
The Ctrl-C event corresponds to which control signal?
A. CTRL_CLOSE_EVENT
B. CTRL_BREAK_EVENT
C. CTRL_C_EVENT
D. CTRL_SHUTDOWN_EVENT
Correct Answer: C
Chapter: 60
Q1235:
The main loop stops when which variable is set to TRUE?
A. handlerFlag
B. exitMain
C. exitFlag
D. loopFlag
Correct Answer: C
Chapter: 60
Q1236:
What function causes the system to wait between beeps in the loop?
A. Wait()
B. Sleep()
C. Delay()
D. Stop()
Correct Answer: B
Chapter: 60
Q1237:
What action does Beep() perform in the loop?
A. Generates error
B. Displays text
C. Plays a sound
D. Closes console
Correct Answer: C
Chapter: 60
Q1238:
The default case in the Handler function handles ______.
A. known exceptions
B. compile-time errors
C. unrecognized events
D. syntax errors
Correct Answer: C
Chapter: 60
Q1239:
SetConsoleCtrlHandler allows adding multiple handlers if _______.
A. the program loops forever
B. Add is set to FALSE
C. Handler is NULL
D. Add is set to TRUE
Correct Answer: D
Chapter: 60
Q1240:
What is printed when a CTRL_C_EVENT is caught by the handler?
A. Ctrl-Break received
B. Close event triggered
C. Ctrl-C received by handler. Leaving in 5 seconds or less.
D. Exiting console.
Correct Answer: C

Test Your Knowledge

Take a timed quiz on System Programming

🚀 Start Quiz Now