This File handling in C Quiz will help you to test and validate your knowledge of file handling in C. It covers a variety of questions, from basic to advanced. You just have to assess all the given options and click on the correct answer.
Question 1
Which of the following true about FILE *fp
FILE is a keyword in C for representing files and fp is a variable of FILE type.
FILE is a structure and fp is a pointer to the structure of FILE type
FILE is a stream
FILE is a buffered stream
Question 2
Question 3
When does getc() returns EOF?
End of files is reached
When getc() fails to read a character
Both of the above
None of the above
Question 4
Which of the following is corrrect?
In fopen(), the open mode "wx" is sometimes preferred over "w" because.
1) Use of wx is more efficient.
2) If w is used, old contents of file are erased and a new empty file is created. When wx is used, fopen() returns NULL if file already exists.
Only 1
Only 2
Both 1 and 2
Neither 1 nor 2
Question 5
fseek() should be preferred over rewind() mainly because
rewind() doesn\'t work for empty files
rewind() may fail for large files
In rewind, there is no way to check if the operations completed successfully
All of the above
There are 5 questions to complete.