In file handling, what does the 'b' flag in file modes like 'rb' or 'wb' indicate?
Q.702Medium
Which function is used to read a string from a file, including whitespace characters, up to a maximum length?
Q.703Medium
In the context of ferror() function, what does it return?
Q.704Medium
Which mode should be used if you want to read and write to a file without truncating existing content?
Q.705Medium
What is the purpose of the clearerr() function in file handling?
Advertisement
Q.706Medium
Consider a scenario where fopen() fails to open a file. Which of the following is the correct way to handle it?
Q.707Medium
What does ftell() function return?
Q.708Medium
Which of the following fseek() calls will position the file pointer at the end of the file?
Q.709Medium
What is the difference between text mode and binary mode when reading files?
Q.710Medium
Which function is used to read formatted data from a file, similar to scanf() but for files?
Q.711Medium
What will be the behavior of fgets() when reading from an empty line in a file?
Q.712Hard
In a program reading a binary file of 1000 integers, fread() is called as: fread(arr, sizeof(int), 1000, fp). If only 500 integers are present, what will fread() return?
Q.713Hard
Consider using fseek() on a file opened in text mode with SEEK_END and a non-zero offset. What is the standard behavior?
Q.714Hard
A program writes data using fprintf() and later attempts to read it back. However, the read operation fails intermittently. What could be the most likely cause?
Q.715Hard
What is the purpose of using fflush() in file handling, and when is it critical to use it?
Q.716Easy
Which function is used to determine the current position in a file?
Q.717Easy
What is the correct syntax to open a file named 'data.txt' in read mode?
Q.718Easy
Which mode allows both reading and writing to a file, creating it if it doesn't exist?
Q.719Easy
What does the fclose() function do?
Q.720Medium
A program reads a text file line by line using fgets(). If a line contains more characters than the buffer size, what happens?