System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 20
Q421:
The ReportError() function uses which function to print to the standard error stream?
A. _printf()
B. _fprintf()
C. _ftprintf()
D. printf()
Correct Answer:
C
Chapter: 20
Q422:
The macro _T() is used in ReportError() to support _______.
A. Unicode only
B. ASCII only
C. Generic text mappings
D. Both ASCII and Unicode
Correct Answer:
D
Chapter: 20
Q423:
Which function converts the error code into a localized message string?
A. GetLastError()
B. FormatMessage()
C. LocalFree()
D. ExitProcess()
Correct Answer:
B
Chapter: 20
Q424:
What datatype is used for the printErrorMessage parameter?
A. BOOL
B. DWORD
C. LPCTSTR
D. int
Correct Answer:
A
Chapter: 20
Q425:
If eMsgLen <= 0, what will ReportError() print?
A. User message only
B. Error code only
C. Both user message and error code
D. Nothing
Correct Answer:
B
Chapter: 21
Q426:
How many standard IO devices are used in the operating system?
A. 1
B. 2
C. 3
D. 4
Correct Answer:
C
Chapter: 21
Q427:
Which of the following is NOT a standard IO device?
A. Input
B. Output
C. Storage
D. Error
Correct Answer:
C
Chapter: 21
Q428:
By default, the printf command sends output to the _______.
A. standard input
B. device file
C. standard output
D. device driver
Correct Answer:
C
Chapter: 21
Q429:
The getch function receives input from the _______.
A. standard output
B. standard input
C. standard error
D. console log
Correct Answer:
B
Chapter: 21
Q430:
What Windows data type is used to manipulate IO devices?
A. Pointer
B. HANDLE
C. File
D. Socket
Correct Answer:
B
Chapter: 21
Q431:
Which API function is used to get a handle to a standard IO device?
A. GetStdHandle()
B. SetStdHandle()
C. CloseHandle()
D. OpenHandle()
Correct Answer:
A
Chapter: 21
Q432:
What does GetStdHandle() return if the function fails?
A. NULL
B. INVALID_HANDLE_VALUE
C. -1
Correct Answer:
B
Chapter: 21
Q433:
If a handle is closed, it becomes _______ for the process.
A. usable
B. locked
C. unusable
D. duplicated
Correct Answer:
C
Chapter: 21
Q434:
Which of the following is a valid value for the nStdHandle parameter?
A. STD_INPUT_HANDLE
B. STD_FILE_HANDLE
C. STD_NETWORK_HANDLE
D. STD_SOCKET_HANDLE
Correct Answer:
A
Chapter: 21
Q435:
STD_OUTPUT_HANDLE corresponds to which environment variable?
A. CONIN$
B. CONOUT$
C. STDOUT$
D. STDERR$
Correct Answer:
B
Chapter: 21
Q436:
SetStdHandle() is used for ________ of standard IO handles.
A. closing
B. creating
C. duplicating
D. redirecting
Correct Answer:
D
Chapter: 21
Q437:
The default standard error device is associated with _______.
A. Console
B. Output file
C. Error log
D. Input device
Correct Answer:
C
Chapter: 21
Q438:
If GetStdHandle(STD_INPUT_HANDLE) succeeds, it returns a ______.
A. 1
B. handle
C. NULL
Correct Answer:
B
Chapter: 21
Q439:
Standard IO handles are used to manipulate IO devices in the _______ environment.
A. Windows
B. Linux
C. Unix
D. DOS
Correct Answer:
A
Chapter: 21
Q440:
Which data type is passed as the second parameter to SetStdHandle()?
A. DWORD
B. HANDLE
C. BOOL
D. int
Correct Answer:
B