System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 21
Q441:
Which function is used to change the standard IO handle to a new handle?
A. GetStdHandle()
B. SetStdHandle()
C. CloseHandle()
D. OpenHandle()
Correct Answer:
B
Chapter: 22
Q442:
Which header file includes all required Windows API functions for the given program?
A. <stdio.h>
B. <Windows.h>
C. <everything.h>
D. <stdarg.h>
Correct Answer:
C
Chapter: 22
Q443:
What is the purpose of the Options() function in the program?
A. Display files
B. Copy files
C. Parse command line options
D. Handle errors
Correct Answer:
C
Chapter: 22
Q444:
The Options() function checks for a prefix _______ to identify command line options.
A. --
B. /
C. -
D. *
Correct Answer:
C
Chapter: 22
Q445:
Which data type is used to hold flags for options in the Options() function?
A. LPBOOL
B. DWORD
C. LPSTR
D. BOOL
Correct Answer:
A
Chapter: 22
Q446:
The Options() function uses which macro to start processing variable arguments?
A. va_start
B. va_arg
C. va_end
D. va_list
Correct Answer:
A
Chapter: 22
Q447:
In the Options() function, the loop continues until all flags are checked or ________ is reached.
A. argc
B. iFlag
C. optStr length
D. iArg
Correct Answer:
D
Chapter: 22
Q448:
What does the CatFile function do in this program?
A. Open a file
B. Copy contents from one file handle to another
C. Close a file
D. Display file name
Correct Answer:
B
Chapter: 22
Q449:
In CatFile, what is the purpose of the buffer array?
A. Store file names
B. Store data to be copied
C. Store error messages
D. Store file handles
Correct Answer:
B
Chapter: 22
Q450:
What Windows API function reads data from a file handle in CatFile?
A. WriteFile
B. ReadFile
C. CreateFile
D. DeleteFile
Correct Answer:
B
Chapter: 22
Q451:
Which Windows API function is used to write data to the output handle in CatFile?
A. ReadFile
B. WriteFile
C. CloseHandle
D. CreateFile
Correct Answer:
B
Chapter: 22
Q452:
The CatFile function continues copying while ReadFile returns data and WriteFile _______.
A. receives data
B. returns success
C. returns failure
D. returns zero
Correct Answer:
B
Chapter: 22
Q453:
In the Options() function, the _memtchr function checks for the presence of option characters in _______.
A. Command line arguments
B. Environment variables
C. Files
D. Program code
Correct Answer:
A
Chapter: 22
Q454:
The variable iFlag in Options() function is used to iterate over _______.
A. Command line arguments
B. Option string
C. Files
D. Flags
Correct Answer:
B
Chapter: 22
Q455:
Which keyword is used to define CatFile as accessible only within the source file?
A. static
B. extern
C. volatile
D. inline
Correct Answer:
A
Chapter: 22
Q456:
What type is the buffer array declared as in CatFile function?
A. BYTE
B. DWORD
C. CHAR
D. LPSTR
Correct Answer:
A
Chapter: 22
Q457:
The function _tcslen() used in Options() returns the length of a _______.
A. String
B. Buffer
C. Flag
D. Handle
Correct Answer:
A
Chapter: 22
Q458:
In the context of this program, HANDLE represents a _______.
A. File descriptor
B. Memory address
C. Network socket
D. Variable pointer
Correct Answer:
A
Chapter: 22
Q459:
Which variable in CatFile stores the number of bytes read from input file?
A. nIn
B. nOut
C. BUF_SIZE
D. hInFile
Correct Answer:
A
Chapter: 22
Q460:
Which variable in CatFile stores the number of bytes written to output file?
A. nIn
B. nOut
C. BUF_SIZE
D. hOutFile
Correct Answer:
B