C Objective Interview Questions On Files

These C Objective Interview Questions On Files post providing basic, intermediate and Hard level examples in C Files. The Practice of these examples makes you good in C programming.


What are the arguments of fopen() are

  1. Path to file and file mode
  2. File mode and file path
  3. Both a and b
  4. None of the mentioned of the mentioned.

Answer :

Ans : 1

fopen() function returns ______ in case of error

  1. 0
  2. EOF
  3. NULL
  4. False

Answer :

Ans : 3 , because fopen() function return type is pointer type

Which is true about getc() returns?

  1. The next character from the stream referred to by file pointer
  2. EOF for end of file or error
  3. Both a & b
  4. None of above.

Answer :

Ans : 3

FILE is of type ______ ?

  1. int type
  2. char * type
  3. void* type
  4. Reserved name type

Answer :

Ans : 4

FILE* which is pointing to a text file is of ______?

  1. int type
  2. char * type
  3. struct type
  4. None of the mentioned.

Answer :

Ans : 2

Which type of files can’t be opened using fopen()?

  1. .txt
  2. .bak
  3. .c
  4. None of the mentioned

Answer :

Ans : 4

What is the functionality to rewind() function?

  1. Resets cursor position to beginning of file
  2. Sends the file pointer stream to end of a file.
  3. used to exit from the file.
  4. No such type of function in file handling

Answer :

Ans : 1

What can ungetc() function do in a file?

  1. Push back a character back into stream
  2. Deletes a specific character from stream
  3. Replace a character from specified character in the file
  4. All of the above
  5. None of the above.

Answer :

Ans : 1

What is the difference between perror() and printf() function?

  1. Both will print info on console
  2. perror() writes only text whereas printf() can write different formats
  3. Perror() writes user message along with system message
  4. All of above

Answer :

Ans : 4

Write fseek() function call which is exactly equal to rewind()?

  1. fseek(file_pointer, SEEK_SET , 1)
  2. fseek(file_pointer, SEEK_END , 0)
  3. fseek(file_pointer, SEEK_SET , 0)
  4. None of the above mentioned

Answer :

Ans : 3

What is the use of fseek() function in File handling?

  1. To read character from file
  2. To send control to particular location in the file
  3. To get particular position
  4. All of above
  5. None of above.

Answer :

Ans : 2

 C Technical Interview Questions On Storage Classes – Part1

Share this