C - Files and Preprocessors Questions and Answers

Take Exam

C Files and Preprocessors Questions with Answers are essential for mastering file handling, macros, and directives in C programming. As part of programming questions and answers for placement exams, this topic helps students understand real-world input/output operations and code optimization techniques. Frequently asked in TCS, Wipro, and Capgemini tests, these questions assess how well you manage data files and preprocess instructions efficiently. Practicing these C programming MCQs with solutions improves your coding proficiency and exam accuracy. Access free C file handling and preprocessor aptitude questions with explanations in PDF or attempt our online mock test.

C - Files and Preprocessors

Showing 10 of 96 questions

11. The default stream pointers available during execution of a program is

  • stdin
  • stdout
  • stderr
  • all the above
Show Answer Report

12. The function call fopen ("data", "w+b")

  • is invalid
  • returns the file pointer pointing to file named data and opern the file for reading and writing using binary stream
  • returns the file pointer pointing to file named data and opens the file for reading and writing using text stream
  • does not return file pointer
Show Answer Report

13. If fopen ( ) fails, it returns

  • -1
  • NULL
  • 1
  • the file pointer
Show Answer Report

14. The function fclose ( ) is

  • used to disconnect a program from file
  • used to close a file logically
  • both options a and b
  • a mandatory function call in file handling
Show Answer Report

15. The action of connecting a program to a file is obtained by using I

  • connect ( )
  • fopen ( )
  • OPEN ( )
  • file ( )
Show Answer Report

16. The action of disconnecting a program from a file is obtained by the function

  • fclose ( )
  • delete ()
  • fdisconnect ()
  • clear ( )
Show Answer Report

17. The value returned by fclose(), if an error occurs is

  • 0
  • 1
  • EOF
  • -1
Show Answer Report

18. The value returned by fclose ( ) for successful closing of a file is

  • 0
  • 1
  • EOF
  • OK
Show Answer Report

19. The function(s) used  for reading a character from a file is (are)

  • ggetc()
  • fgetc()
  • both options a and b
  • fgetchar()
Show Answer Report

20. The function(s) used for reading formatted input data from a file is (are)

  • putc( )
  • fputc( )
  • both options a and b
  • fputchar ( )
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test