System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 27
Q601:
ENABLE_LINE_INPUT mode ensures input is read only after ______.
A. a space is entered
B. enter key is pressed
C. tab is pressed
D. output is written
Correct Answer:
B
Chapter: 27
Q602:
PrintStrings returns FALSE if ______.
A. va_list is NULL
B. console handle is invalid
C. WriteConsole and WriteFile both fail
D. Console is not created
Correct Answer:
C
Chapter: 27
Q603:
PrintMsg() is a utility function that ______.
A. reads user input
B. writes multiple messages
C. writes a single message
D. creates a console handle
Correct Answer:
C
Chapter: 27
Q604:
To prevent input echoing in ConsolePrompt, which flag is omitted?
A. ENABLE_LINE_INPUT
B. ENABLE_PROCESSED_OUTPUT
C. ENABLE_WRAP_AT_EOL_OUTPUT
D. ENABLE_ECHO_INPUT
Correct Answer:
D
Chapter: 27
Q605:
In ConsolePrompt, what does the function ReadConsole do?
A. Reads input from buffer
B. Writes to console
C. Closes console
D. Allocates memory
Correct Answer:
A
Chapter: 27
Q606:
The PrintStrings function uses va_arg to ______.
A. end loop over arguments
B. access next argument
C. initialize argument list
D. handle file output
Correct Answer:
B
Chapter: 27
Q607:
To start processing variable arguments in PrintStrings, ______ is used.
A. va_start
B. va_arg
C. va_end
D. none of these
Correct Answer:
A
Chapter: 27
Q608:
The prompt displayed by ConsolePrompt is stored in ______.
A. hIn
B. pResponse
C. pPromptMsg
D. hOut
Correct Answer:
C
Chapter: 27
Q609:
ConsolePrompt uses which input function to read from user?
A. ReadFile
B. ReadConsole
C. ReadLine
D. ScanConsole
Correct Answer:
B
Chapter: 28
Q610:
Which function is used to get the current working directory in Windows API?
A. GetDirectory()
B. GetCurrentDirectory()
C. GetPath()
D. CurrentDirectory()
Correct Answer:
B
Chapter: 28
Q611:
What type is the variable `pwdBuffer` declared as?
A. char[]
B. TCHAR[]
C. string[]
D. wchar_t[]
Correct Answer:
B
Chapter: 28
Q612:
What does the macro DIRNAME_LEN represent?
A. Length of the file
B. Length of input buffer
C. Buffer size for directory path
D. Length of output string
Correct Answer:
C
Chapter: 28
Q613:
The maximum length of the directory path is defined using which constant?
A. MAX_BUFFER
B. PATH_MAX
C. MAX_PATH
D. MAX_LEN
Correct Answer:
C
Chapter: 28
Q614:
The return type of GetCurrentDirectory is ______.
A. BOOL
B. DWORD
C. int
D. HANDLE
Correct Answer:
B
Chapter: 28
Q615:
Which function is used to print the current directory to the console?
A. printf()
B. WriteConsole()
C. PrintMsg()
D. ConsoleWrite()
Correct Answer:
C
Chapter: 28
Q616:
If GetCurrentDirectory returns 0, it indicates ______.
A. success
B. path exists
C. empty string
D. failure
Correct Answer:
D
Chapter: 28
Q617:
The function ReportError is used to ______.
A. handle success
B. case-switch blocks
C. handle errors
D. buffer strings
Correct Answer:
C
Chapter: 28
Q618:
Which handle is passed to PrintMsg in the example?
A. GetInputHandle()
B. GetErrorHandle()
C. GetConsoleHandle()
D. GetStdHandle()
Correct Answer:
D
Chapter: 28
Q619:
What is passed as the first argument to GetCurrentDirectory?
A. pwdBuffer
B. size of pwdBuffer
C. DIRNAME_LEN
D. size of current path
Correct Answer:
C
Chapter: 28
Q620:
Which preprocessor directive defines the buffer size in the code?
A. #include
B. #define
C. #define MAX_PATH
D. #define DIRNAME_LEN
Correct Answer:
B