System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Multiple Choice Questions
Q331: What is the return type of the CreateFile() API in Windows?
- A: INT
- B: VOID
- C: HANDLE
- D: BOOL
View Answer
C
Q332: The CreateFile() API is used to _______.
- A: Read or write to a file
- B: Delete a file
- C: Open or create a new file
- D: Close a file
View Answer
C
Q333: The parameter lpFileName in CreateFile() API points to the _______.
- A: File size
- B: File name
- C: File attributes
- D: File handle
View Answer
B
Q334: The dwDesiredAccess parameter specifies _______.
- A: File creation mode
- B: Access mode (read/write)
- C: File sharing mode
- D: File attributes
View Answer
B
Q335: If dwShareMode is set to 0, it means the file will be _______.
- A: Shared for reading
- B: Shared for writing
- C: Not shared
- D: Shared for read and write
View Answer
C
Q336: Which dwShareMode value allows a file to be shared for concurrent reading?
- A: FILE_SHARE_WRITE
- B: FILE_SHARE_READ
- C: FILE_SHARE_EXECUTE
- D: CREATE_NEW
View Answer
B
Q337: CREATE_NEW in the dwCreate parameter means _______.
- A: Create a new file or overwrite
- B: Create a new file, fail if exists
- C: Open an existing file
- D: Open or create a file
View Answer
B
Q338: CREATE_ALWAYS in the dwCreate parameter will _______.
- A: Create new file, fail if exists
- B: Create new file or overwrite existing file
- C: Open existing file only
- D: Open or create a file
View Answer
D
Q339: OPEN_EXISTING in the dwCreate parameter _______.
- A: Always creates a new file
- B: Opens an existing file or fails if file not found
- C: Always overwrites the file
- D: Allows shared access
View Answer
B
Q340: OPEN_ALWAYS in the dwCreate parameter will _______.
- A: Only open existing file
- B: Open existing file or create if not exists
- C: Always create new file
- D: Always fail if file exists
View Answer
B