System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 94
Q2041:
lpTargetHandle in DuplicateHandle() returns a valid handle in the ______.
A. parent process
B. target process
C. source thread
D. kernel
Correct Answer:
B
Chapter: 94
Q2042:
The access rights of a duplicated handle can be changed using ______.
A. access flag
B. option value
C. desiredAccess
D. dwDesiredAccess
Correct Answer:
D
Chapter: 94
Q2043:
Which DuplicateHandle flag causes automatic closure of the source handle?
A. ACCESS_CLOSE
B. DUPLICATE_HANDLE_CLOSE
C. DUPLICATE_CLOSE_SOURCE
D. PROCESS_CLOSE
Correct Answer:
C
Chapter: 94
Q2044:
The function DuplicateHandle requires ______ parameters.
A. 4
B. 6
C. 7
D. 5
Correct Answer:
C
Chapter: 94
Q2045:
Which of the following is NOT a parameter in DuplicateHandle()?
A. hTargetProcessHandle
B. hSourceHandle
C. desiredHandle
D. lpThreadData
Correct Answer:
D
Chapter: 95
Q2046:
Which function is used to exit a process in Windows?
A. TerminateProcess()
B. KillProcess()
C. ExitThread()
D. ExitProcess()
Correct Answer:
D
Chapter: 95
Q2047:
What happens when ExitProcess() is called?
A. Process pauses
B. Process suspends
C. Only one thread ends
D. Process and all threads terminate
Correct Answer:
D
Chapter: 95
Q2048:
ExitProcess() does not send control to ______.
A. ExitThread()
B. Termination handlers
C. DllMain()
D. OS scheduler
Correct Answer:
B
Chapter: 95
Q2049:
What does ExitProcess() send to DllMain()?
A. Error code
B. Exception
C. handler call
D. Detach call
Correct Answer:
D
Chapter: 95
Q2050:
Which parameter is passed to ExitProcess()?
A. process name
B. thread ID
C. exit code
D. handle ID
Correct Answer:
C
Chapter: 95
Q2051:
What does the API GetExitCodeProcess() retrieve?
A. Thread ID
B. Exit code of a process
C. Process name
D. Handle permissions
Correct Answer:
B
Chapter: 95
Q2052:
To use GetExitCodeProcess(), the handle must have ______ access.
A. PROCESS_DUP_HANDLE
B. PROCESS_VM_READ
C. PROCESS_QUERY_INFORMATION
D. PROCESS_TERMINATE
Correct Answer:
C
Chapter: 95
Q2053:
What type is the lpExitCode parameter in GetExitCodeProcess()?
A. char pointer
B. string
C. pointer to DWORD
D. int pointer
Correct Answer:
C
Chapter: 95
Q2054:
Which of the following is a possible value for an exit code?
A. EXIT_FAILED
B. PROCESS_EXITED
C. THREAD_TERMINATED
D. STILL_ACTIVE
Correct Answer:
D
Chapter: 95
Q2055:
Which function is used to terminate another process forcibly?
A. CloseHandle()
B. ExitProcess()
C. KillThread()
D. TerminateProcess()
Correct Answer:
D
Chapter: 95
Q2056:
What is passed as the first parameter to TerminateProcess()?
A. Process ID
B. Process name
C. Thread ID
D. Process handle
Correct Answer:
D
Chapter: 95
Q2057:
Which parameter in TerminateProcess() is returned by the terminated process?
A. Thread ID
B. Error message
C. Exit code
D. Process name
Correct Answer:
C
Chapter: 95
Q2058:
Calling ExitProcess() from within a program is discouraged because ______.
A. it blocks threads
B. it restarts the program
C. it prevents resource cleanup
D. it runs slower
Correct Answer:
C
Chapter: 95
Q2059:
Proper way to exit a process involves ______.
A. only closing file descriptors
B. only closing handles
C. waiting for I/O
D. releasing all handles first
Correct Answer:
D
Chapter: 95
Q2060:
TerminateProcess() does not allow the process to execute ______.
A. Exit handlers
B. SHE or DllMain()
C. Thread closure
D. Exit codes
Correct Answer:
B