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 1 Explanation:
fp is a pointer of FILE type and FILE is a structure that store following information about opened file.
When fopen() is not able to open a file, it returns
Question 2 Explanation:
fopen() returns NULL if it is not able to open the given file due to any of the reasons like file not present, inappropriate permissions, etc.
getc() returns EOF when
End of files is reached
When getc() fails to read a character
Both of the above
None of the above
Question 3 Explanation:
In fopen(), the open mode "wx" is sometimes preferred "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.
Both 1 and 2
Neither 1 nor 2
Question 4 Explanation:
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
Question 5 Explanation:
Please see fseek() vs rewind() in C
There are 5 questions to complete.
My Personal Notes arrow_drop_up