System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Multiple Choice Questions
Q351: ReadFile() returns FALSE when _______.
- A: File is at EOF
- B: A parameter is invalid
- C: Read is successful
- D: Bytes read is zero
View Answer
B
Q352: lpNumberOfBytesRead in ReadFile() API is used to _______.
- A: Store the number of bytes requested
- B: Store the number of bytes actually read
- C: Store the file size
- D: Store the file handle
View Answer
B
Q353: What is the role of the LPOVERLAPPED parameter?
- A: For file security
- B: For file naming
- C: For concurrent processing
- D: For error handling
View Answer
C
Q354: WriteFile() API is used to _______.
- A: Read data from buffer to file
- B: Write data from buffer to file
- C: Read data from file to buffer
- D: Close a file
View Answer
B
Q355: To write through the current size of the file, the file must be opened with _______.
- A: FILE_FLAG_OVERLAPPED
- B: FILE_FLAG_WRITE_THROUGH
- C: FILE_SHARE_WRITE
- D: FILE_SHARE_READ
View Answer
B
Q356: Which parameter in WriteFile() specifies how many bytes are written?
- A: lpBuffer
- B: lpNumberOfBytesWritten
- C: nNumberOfBytesToWrite
- D: hFile
View Answer
B
Q357: The WriteFile() API returns FALSE when _______.
- A: File is not opened in write mode
- B: Any parameter is invalid
- C: Write is successful
- D: Bytes written is zero
View Answer
A
Q358: The WriteFile() function's lpBuffer parameter holds _______.
- A: File handle
- B: Data to write
- C: File size
- D: Number of bytes to write
View Answer
B
Q359: If ReadFile() succeeds but reads zero bytes, it indicates _______.
- A: Invalid parameters
- B: End of file
- C: Write failure
- D: Buffer overflow
View Answer
B
Q360: ReadFile() and WriteFile() APIs are synchronous by default unless used with _______.
- A: FILE_FLAG_WRITE_THROUGH
- B: FILE_FLAG_OVERLAPPED
- C: CREATE_NEW
- D: OPEN_EXISTING
View Answer
B