System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 9
Q261:
The LPWSTR data type in Windows API stands for
A. Pointer to wide string
B. Long pointer to wide string
C. Wide character buffer
D. Handle to string
Correct Answer:
B
Chapter: 9
Q262:
If writing fails in the loop, what is printed?
A. Fatal read error
B. Fatal copy error
C. Fatal write error
D. None of these
Correct Answer:
C
Chapter: 9
Q263:
The memory for `lpwszFile1` and `lpwszFile2` is allocated using
A. new()
B. Calloc()
C. malloc()
D. GlobalAlloc()
Correct Answer:
C
Chapter: 9
Q264:
What Windows API function is used to close file handles?
A. CloseFile()
B. CloseHandle()
C. fclose()
D. ShutFile()
Correct Answer:
B
Chapter: 9
Q265:
ReadFile() and WriteFile() are functions provided by
A. Standard C
B. Windows API
C. POSIX
D. MS-DOS
Correct Answer:
B
Chapter: 9
Q266:
The file path arguments from command line are initially in
A. Unicode
B. Binary
C. ASCII
D. Hex
Correct Answer:
C
Chapter: 9
Q267:
The type of the variable used to store number of bytes read is
A. INT
B. CHAR
C. DWORD
D. float
Correct Answer:
C
Chapter: 9
Q268:
The handle for the output file is stored in
A. hOut
B. outFile
C. hOutput
D. output
Correct Answer:
C
Chapter: 9
Q269:
This program is written in which programming language?
A. Python
B. C
C. C++
D. Assembly
Correct Answer:
B
Chapter: 9
Q270:
A file is opened for reading using which mode in CreateFile()?
A. GENERIC_WRITE
B. GENERIC_EXECUTE
C. GENERIC_READ
D. GENERIC_APPEND
Correct Answer:
C
Chapter: 9
Q271:
The source file is opened using which flag in CreateFile()?
A. CREATE_ALWAYS
B. OPEN_EXISTING
C. OPEN_ALWAYS
D. READ_ONLY
Correct Answer:
B
Chapter: 9
Q272:
To convert command line string to wide string, the function used is
A. strconv()
B. StringToWideChar()
C. MultiByteToWideChar()
D. WideCharToMultiByte()
Correct Answer:
C
Chapter: 9
Q273:
If CreateFile fails, which function provides the error code?
A. GetError()
B. LastError()
C. GetLastError()
D. ReportError()
Correct Answer:
C
Chapter: 9
Q274:
The input file is read using which buffer?
A. inputBuffer[]
B. CHAR buffer[]
C. ReadData[]
D. lpBuffer[]
Correct Answer:
B
Chapter: 9
Q275:
Which value is returned if the program usage is incorrect?
A. 2
B. 4
C. 3
D. 1
Correct Answer:
D
Chapter: 9
Q276:
The loop for copying continues until
A. ReadFile returns 0
B. All bytes are read
C. All lines are read
D. WriteFile fails
Correct Answer:
A
Chapter: 10
Q277:
Which Windows API function simplifies the file copy process?
A. CopyFile()
B. WriteFile()
C. ReadFile()
D. fcopy()
Correct Answer:
A
Chapter: 10
Q278:
What is the main benefit of using Windows Convenience Functions?
A. They increase security
B. They reduce file size
C. They combine multiple operations into one function
D. They compile code faster
Correct Answer:
C
Chapter: 10
Q279:
The function CopyFile() replaces which operations?
A. Reading only
B. Writing only
C. Creating, opening, reading and writing
D. Deleting files
Correct Answer:
C
Chapter: 10
Q280:
What is the correct number of command-line arguments required in this program?
A. 1
B. 2
C. 3
D. 4
Correct Answer:
C