Skip to main content

System Programming MCQs with Answers

Practice important System Programming MCQs with answers and explanations.

Chapter: 8
Q241:
fopen(argv[1], "rb") opens the file in
A. reading mode
B. writing mode
C. text mode
D. binary reading mode
Correct Answer: D
Chapter: 8
Q242:
The line `FILE *inFile, *outFile;` declares
A. variables to store filenames
B. file handles to work with
C. integer buffers
D. error handlers
Correct Answer: B
Chapter: 8
Q243:
Which data type is used to store the number of bytes read and written?
A. int
B. size_t
C. char
D. long
Correct Answer: B
Chapter: 8
Q244:
The function fread() returns
A. the number of records
B. read pointer
C. count of bytes read
D. buffer address
Correct Answer: C
Chapter: 8
Q245:
The `argc!=3` check ensures that
A. program will compile correctly
B. two filenames are passed
C. program opens one file only
D. error handling is skipped
Correct Answer: B
Chapter: 8
Q246:
Usage of perror() is to
A. display memory size
B. print arguments
C. handle file data
D. report file operation errors
Correct Answer: D
Chapter: 8
Q247:
If both files are successfully opened, the program enters
A. a shutdown mode
B. file locking mode
C. a loop to copy data
D. error handler
Correct Answer: B
Chapter: 8
Q248:
Binary mode in fopen() ensures
A. text formatting is preserved
B. file is converted to hex
C. formatting is ignored
D. file is read and written as raw bytes
Correct Answer: D
Chapter: 8
Q249:
The copied file will be created using
A. `fread()` only
B. `fopen()` with "wb" mode
C. `fprintf()` command
D. line editor
Correct Answer: B
Chapter: 8
Q250:
After the file copy loop, the program closes both files using
A. open()
B. abort()
C. fclose()
D. quit()
Correct Answer: C
Chapter: 9
Q251:
Which Windows function is used to open a file for reading?
A. fopen()
B. ReadFile()
C. CreateFile()
D. OpenFile()
Correct Answer: C
Chapter: 9
Q252:
Which function is used to convert ASCII to Unicode in the program?
A. WideCharToMultiByte()
B. MultiByteToWideChar()
C. StringToUnicode()
D. AsciiToUnicode()
Correct Answer: B
Chapter: 9
Q253:
The Windows API data type used to define a file handle is
A. DWORD
B. CHAR
C. HANDLE
D. INT
Correct Answer: C
Chapter: 9
Q254:
Which value of `argc` indicates correct command-line input for this program?
A. 2
B. 3
C. 1
D. 4
Correct Answer: B
Chapter: 9
Q255:
The buffer size defined in the program is
A. 256 bytes
B. 8192 bytes
C. 16384 bytes
D. 1024 bytes
Correct Answer: C
Chapter: 9
Q256:
What does the constant `GENERIC_READ` signify in CreateFile()?
A. File will be deleted
B. File will be copied
C. File will be read
D. File will be opened for editing
Correct Answer: C
Chapter: 9
Q257:
The destination file is created using which flag in CreateFile()?
A. OPEN_EXISTING
B. CREATE_NEW
C. APPEND_ALWAYS
D. CREATE_ALWAYS
Correct Answer: D
Chapter: 9
Q258:
Which function is used to read from a file in this Windows API program?
A. fread()
B. ReadFile()
C. InputStream()
D. read()
Correct Answer: B
Chapter: 9
Q259:
In this program, which function is used to write to a file?
A. fwrite()
B. WriteFile()
C. output()
D. SendFile()
Correct Answer: B
Chapter: 9
Q260:
If the source file fails to open, what value is returned?
A. 1
B. 3
C. 2
D. 4
Correct Answer: C

Test Your Knowledge

Take a timed quiz on System Programming

🚀 Start Quiz Now