System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 183
Q3981:
Which handle is assigned to `startInfoCh1.hStdOutput`?
A. GetStdHandle(STD_OUTPUT_HANDLE)
B. hReadPipe
C. hWritePipe
D. GetStdHandle(STD_INPUT_HANDLE)
Correct Answer:
C
Chapter: 183
Q3982:
What happens if CreatePipe() fails?
A. The program prints success
B. The program continues without a pipe
C. A report error function is called
D. The process halts silently
Correct Answer:
C
Chapter: 183
Q3983:
The purpose of CloseHandle() after creating a process is to
A. close unnecessary handles
B. save memory
C. prevent memory leaks
D. release system resources
Correct Answer:
D
Chapter: 183
Q3984:
The command line argument `targv` holds
A. the full path of command1
B. and command2
C. pipe handles
D. second command
Correct Answer:
A
Chapter: 183
Q3985:
What ensures that the pipe handles are inherited by the child process?
A. Inheritable flag set to TRUE
B. Inheritable flag set to FALSE
C. Using global variables
D. No security attributes provided
Correct Answer:
A
Chapter: 183
Q3986:
Which function waits until the specified process finishes execution?
A. WaitForFinish()
B. WaitForExit()
C. WaitForSingleObject()
D. WaitForProcess()
Correct Answer:
C
Chapter: 183
Q3987:
Command1 receives input through
A. standard input redirected to pipe
B. standard output redirected to pipe
C. standard input from keyboard
D. file stream
Correct Answer:
A
Chapter: 183
Q3988:
Command2 receives its output through
A. standard output
B. standard input
C. standard error redirected
D. standard output redirected to file
Correct Answer:
A
Chapter: 183
Q3989:
GetStdHandle(STD_INPUT_HANDLE) returns
A. the standard input handle
B. the standard output handle
C. the pipe handle
D. the process handle
Correct Answer:
A
Chapter: 183
Q3990:
If GetCommandLine() returns NULL, the program
A. calls ReportError
B. executes default commands
C. restarts the system
D. returns 1
Correct Answer:
A
Chapter: 183
Q3991:
The process creation functions used in the code are
A. CreateFile() and ReadFile()
B. CreateProcess() and WaitForSingleObject()
C. CreatePipe() and InitProcess()
D. CreateHandle() and StartProcess()
Correct Answer:
B
Chapter: 183
Q3992:
The `dwFlags` field in STARTUPINFO structure is set to
A. STARTF_USESTDHANDLES
B. to enable pipe streaming
C. to execute background process
D. to set default values
Correct Answer:
A
Chapter: 183
Q3993:
The STARTUPINFO structure is used to
A. initialize the input/output/error handles
B. initialize security settings
C. define command structure
D. store thread IDs
Correct Answer:
A
Chapter: 184
Q3994:
Which IPC mechanism supports message-oriented communication between processes?
A. Anonymous pipes
B. Memory-mapped files
C. Named pipes
D. Semaphores
Correct Answer:
C
Chapter: 184
Q3995:
Named pipes allow communication between processes on
A. only the same machine
B. different machines only
C. the same or different machines
D. only networked systems
Correct Answer:
C
Chapter: 184
Q3996:
Named pipes are ________, meaning two processes can communicate over the same pipe.
A. unidirectional
B. bi-directional
C. half-duplex
D. full-duplex
Correct Answer:
B
Chapter: 184
Q3997:
How many instances of a named pipe can exist at a time?
A. Only one
B. Two
C. Multiple
D. None
Correct Answer:
C
Chapter: 184
Q3998:
Anonymous pipes are considered
A. complex and robust
B. simple but limited
C. message-based
D. bi-directional
Correct Answer:
B
Chapter: 184
Q3999:
One major advantage of named pipes is that they support _______ communication.
A. threaded
B. message-oriented
C. binary only
D. parallel
Correct Answer:
B
Chapter: 184
Q4000:
A named pipe can be accessed remotely using its
A. identifier
B. address
C. handle
D. name
Correct Answer:
D