Skip to main content

System Programming MCQs with Answers

Practice important System Programming MCQs with answers and explanations.

Chapter: 98
Q2181:
Which Windows API allows the temporary file handle to be inheritable?
A. CreateFile() with SECURITY_ATTRIBUTES
B. CreateFileMapping()
C. CloseHandle()
D. CreateEvent()
Correct Answer: A
Chapter: 98
Q2182:
What will happen if argc < 3?
A. Error message shown
B. Program runs normally
C. Program searches current directory
D. Program crashes
Correct Answer: A
Chapter: 98
Q2183:
How does the program handle spaces in file names?
A. Quotes the filenames
B. Removes spaces
C. Replaces spaces with underscores
D. Skips files with spaces
Correct Answer: A
Chapter: 98
Q2184:
In the code, what is the role of _stprintf()?
A. Formats command line string
B. Reads input
C. Opens files
D. Deletes files
Correct Answer: A
Chapter: 98
Q2185:
What does the min() function in WaitForMultipleObjects do?
A. Ensures max handles per wait
B. Counts processes
C. Calculates elapsed time
D. Checks exit codes
Correct Answer: A
Chapter: 98
Q2186:
Which function is used to get the exit code of a process?
A. GetExitCodeProcess()
B. GetProcessStatus()
C. CheckExitCode()
D. VerifyProcess()
Correct Answer: A
Chapter: 98
Q2187:
Which function waits for a single process to finish?
A. WaitForSingleObject()
B. WaitProcess()
C. WaitOne()
D. WaitProcessEnd()
Correct Answer: A
Chapter: 98
Q2188:
What is the data type of 'hProc'?
A. Pointer to process handles
B. Pointer to files
C. Pointer to threads
D. Pointer to integers
Correct Answer: A
Chapter: 98
Q2189:
How are errors communicated to the user?
A. ReportError() function
B. Exit codes
C. Print to console
D. Log file
Correct Answer: A
Chapter: 98
Q2190:
If CreateProcess() fails, what does the program do?
A. Calls ReportError()
B. Continues silently
C. Retries automatically
D. Exits with code 0
Correct Answer: A
Chapter: 98
Q2191:
What happens to process thread handles after creation?
A. They are closed
B. They remain open
C. They are duplicated
D. They are ignored
Correct Answer: A
Chapter: 98
Q2192:
What does the 'dwCreationFlags' variable control?
A. Process creation options
B. Memory allocation
C. Thread priority
D. Handle inheritance
Correct Answer: A
Chapter: 98
Q2193:
How are temporary file names stored in the program?
A. In an array of PROCFILE structures
B. In a linked list
C. In a string buffer
D. In environment variables
Correct Answer: A
Chapter: 98
Q2194:
What type of synchronization does WaitForMultipleObjects provide?
A. Handles multiple processes
B. Single process
C. Thread synchronization
D. Memory synchronization
Correct Answer: A
Chapter: 98
Q2195:
What is the main benefit of running separate processes for each file?
A. Parallel searching
B. More memory usage
C. Faster file writing
D. Easier debugging
Correct Answer: A
Chapter: 98
Q2196:
The command line argument argv[1] is used as the ______.
A. Search pattern
B. File name
C. Temporary file
D. Exit code
Correct Answer: A
Chapter: 98
Q2197:
The temporary file handle hTempFile is set with which sharing modes?
A. FILE_SHARE_READ | FILE_SHARE_WRITE
B. FILE_SHARE_WRITE only
C. FILE_SHARE_READ only
D. No sharing
Correct Answer: A
Chapter: 98
Q2198:
What happens if DeleteFile fails on a temporary file?
A. ReportError() is called
B. Temporary file is kept silently
C. Program exits
D. Temporary file is renamed
Correct Answer: A
Chapter: 98
Q2199:
Which process information structure contains process and thread handles?
A. PROCESS_INFORMATION
B. STARTUPINFO
C. SECURITY_ATTRIBUTES
D. PROCFILE
Correct Answer: A
Chapter: 98
Q2200:
Which variable holds the count of command line arguments?
A. argc
B. argv
C. hProc
D. exitCode
Correct Answer: A

Test Your Knowledge

Take a timed quiz on System Programming

🚀 Start Quiz Now