System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 98
Q2161:
In the program, what does 'argc' represent?
A. Number of processes
B. Number of command line arguments
C. Number of files
D. Number of patterns
Correct Answer:
B
Chapter: 98
Q2162:
What does the variable 'procFile' store?
A. Pattern strings
B. Process IDs
C. Temporary file names
D. File sizes
Correct Answer:
C
Chapter: 98
Q2163:
What flag is set when creating processes to support Unicode environment?
A. CREATE_UNICODE_ENVIRONMENT
B. CREATE_NEW_CONSOLE
C. CREATE_SUSPENDED
D. CREATE_NO_WINDOW
Correct Answer:
A
Chapter: 98
Q2164:
What function is used to report errors in the program?
A. ReportError()
B. ErrorReport()
C. PrintError()
D. LogError()
Correct Answer:
A
Chapter: 98
Q2165:
What does the command line look like for each grep process?
A. grep pattern file
B. grep file pattern
C. grep "pattern" "filename"
D. grep filename pattern
Correct Answer:
C
Chapter: 98
Q2166:
How are temporary files created for storing output?
A. GetTempFileName()
B. CreateTempFile()
C. OpenTempFile()
D. MakeTempFile()
Correct Answer:
A
Chapter: 98
Q2167:
What access is requested when opening a temporary file for writing?
A. GENERIC_READ
B. GENERIC_WRITE
C. GENERIC_EXECUTE
D. GENERIC_ALL
Correct Answer:
B
Chapter: 98
Q2168:
What happens if CreateFile fails to open the temporary file?
A. Program continues
B. ReportError is called
C. Temporary file is created
D. File is skipped
Correct Answer:
B
Chapter: 98
Q2169:
Which structure holds startup information for each child process?
A. PROCESS_INFORMATION
B. STARTUPINFO
C. SECURITY_ATTRIBUTES
D. COMMAND_LINE
Correct Answer:
B
Chapter: 98
Q2170:
What flag indicates the child process will use the standard handles?
A. STARTF_USESHOWWINDOW
B. STARTF_USESTDHANDLES
C. STARTF_RUNFULLSCREEN
D. STARTF_USEPOSITION
Correct Answer:
B
Chapter: 98
Q2171:
What handles are set for standard output and error in the child process?
A. Standard input handle
B. Temporary file handle
C. Parent process handle
D. System handle
Correct Answer:
B
Chapter: 98
Q2172:
What function is used to create a new process?
A. CreateProcess()
B. StartProcess()
C. RunProcess()
D. LaunchProcess()
Correct Answer:
A
Chapter: 98
Q2173:
What handles are closed immediately after creating the child process?
A. File handle and thread handle
B. Process handle and thread handle
C. File handle and process handle
D. File handle and thread handle
Correct Answer:
D
Chapter: 98
Q2174:
How are process handles stored for waiting?
A. In an array
B. In a linked list
C. In a queue
D. In a stack
Correct Answer:
A
Chapter: 98
Q2175:
What function waits for multiple processes to complete?
A. WaitForSingleObject()
B. WaitForMultipleObjects()
C. WaitForProcess()
D. WaitAllProcesses()
Correct Answer:
B
Chapter: 98
Q2176:
What does the program do with the result files after processes finish?
A. Deletes them
B. Archives them
C. Leaves them open
D. Prints them
Correct Answer:
A
Chapter: 98
Q2177:
How are results displayed after all processes finish?
A. By reading temp files with 'cat' command
B. By copying files
C. By printing file names
D. By deleting files
Correct Answer:
A
Chapter: 98
Q2178:
What is the significance of checking exitCode == 0?
A. Pattern was found
B. Process failed
C. Process skipped
D. Process still running
Correct Answer:
A
Chapter: 98
Q2179:
Which function deletes the temporary files?
A. DeleteFile()
B. RemoveFile()
C. CloseHandle()
D. DeleteTemp()
Correct Answer:
A
Chapter: 98
Q2180:
What must be done after finishing with process handles to avoid resource leaks?
A. CloseHandle()
B. OpenHandle()
C. CopyHandle()
D. FreeHandle()
Correct Answer:
A