What will be the behavior of fgets() when reading from an empty line in a file?
A program reads a text file line by line using fgets(). If a line contains more characters than the buffer size, what happens?
A file is opened in binary mode. How will fseek() behave differently compared to text mode?
A program uses fprintf() to write 1000 integers to a file but doesn't call fclose(). What could happen?
A binary file contains 500 structures of size 32 bytes each. To skip the first 10 structures and read the 11th one, which fseek() call is correct?
Advertisement
Which of the following modes will truncate an existing file?
A program reads a CSV file with fgets() storing data in a 256-byte buffer. Some lines exceed 255 characters. How should this be handled?
What does fflush(fp) do when fp is a file pointer?
In a file opened in "a+" mode, where does the file pointer initially point?
Which mode allows both reading and appending without truncating existing content?
What does the function ftell(fp) return in file handling?
Which of the following correctly reads a string from file with size limit?
A program needs to update specific bytes in the middle of a file without affecting other data. Which approach is most suitable?
What is the difference between 'rb' and 'r' modes when opening a file?
In a file opened with 'rb+' mode, what operations can be performed?
A program reads structured data: fread(ptr, sizeof(struct), count, fp). If fread() returns a value less than 'count', what could be the reason?
In competitive exam file handling questions, if fseek() is called with SEEK_CUR, what does it indicate?
A C program must securely close a file and handle potential errors. What is the best approach?
A program needs to append 500 integers to an existing binary file. Which combination is correct?
What happens if you call fclose() on an already closed file pointer?