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

61. Which of the following is the correct function prototype for the function main ( ) ?

  • main (char argc, char *argv)
  • main (int argc, int *argv)
  • main (int argc, int **argv [ ] )
  • main ( int argc, char * argv [ ] )
Show Answer Report

62. Which is more correct ? 'int main (int argc, char ** argv)' 'int main (int argc, char* argc [ ] )'?

  • both are equally wrong.
  • both are equally correct.
  • neither is correct
  • in main (int argc, char *argv[])
Show Answer Report

63. The function used to position the file pointer in C is

  • seekg( )
  • fseekg( )
  • fseek( )
  • fileseek( )
Show Answer Report

64. The function used to position the file pointer in C is

  • seekg()
  • fseekg ()
  • fseek()
  • fileseek()
Show Answer Report

65. What file I/O function is used to report the number of bytes from the beginning of the file to the file position indicator ?

  • ftell
  • freport
  • fseek
  • fcount
Show Answer Report

66. 1. fcloseall() 2. clearerr() 3. ferror() Which o the above are valid ANSI C functions ?

  • only option 3
  • only option 2
  • only options 2 and 3
  • options 1, 2, and 3 are all valid ANSI functions.
Show Answer Report

67. Which standard file is to be include to use the memcpy() function without a warning in an ANSI C compiler ?

  • string.h
  • memory.h
  • stdlib.h
  • stdio.h
Show Answer Report

68. If there is a need to see output as soon as possible. Which function will force the output from the buffer into the output stream ?

  • write ()
  • output()
  • flush ()
  • fflush()
Show Answer Report

69. After a library function returns a failure, which of the following will print out the appropriate error message corresponding to error number given by errno?

  • printf (stderr, "s\n", geterror ());
  • printerr () ;
  • perror (errno);
  • strerror (errrno);
Show Answer Report

70. Which ANSI c standard function could be used to sort a s tring array ?

  • qsort
  • sort
  • asort
  • bsort
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test