Skip to main content

System Programming MCQs with Answers

Practice important System Programming MCQs with answers and explanations.

Multiple Choice Questions

Q231: Which function is used to close a file in C?
  • A: endfile()
  • B: fclose()
  • C: closefile()
  • D: shutdown()
View Answer
B

Q232: The files are opened in ______ modes respectively for reading and writing.
  • A: text and binary
  • B: binary and text
  • C: text and text
  • D: binary and binary
View Answer
D

Q233: The main data structure used to hold the read content is
  • A: a string
  • B: an array of structs
  • C: a buffer
  • D: array of integers
View Answer
C

Q234: If fwrite does not write all bytes that were read, the program will
  • A: print an error and continue silently
  • B: ignore it and exit normally
  • C: print a fatal write error and return 4
  • D: reboot the system
View Answer
C

Q235: The fread() function reads the file in chunks of
  • A: 256 characters
  • B: 1 byte
  • C: 256 bytes
  • D: 512 bytes
View Answer
C

Q236: The file copy program checks for command-line arguments to avoid
  • A: segmentation fault
  • B: syntax error
  • C: usage error
  • D: linker error
View Answer
C

Q237: Which header file is necessary for file I/O functions like fopen()?
  • A:
  • B:
  • C:
  • D:
View Answer
C

Q238: Which standard function displays the usage message when arguments are incorrect?
  • A: print()
  • B: warn()
  • C: usage()
  • D: printf()
View Answer
D

Q239: The loop continues to copy the file until
  • A: fread returns 0
  • B: bytesIn equals BUF_SIZE
  • C: all data is printed
  • D: fclose is called
View Answer
A

Q240: If fwrite fails during file copy, the return value is set to
  • A: 1
  • B: 2
  • C: 4
  • D: 3
View Answer
C

Test Your Knowledge

Take a timed quiz on System Programming

🚀 Start Quiz Now