🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Files and Preprocessor: all 10 questions

Quiz: Files and Preprocessor · Question 10 of 10

Why should you call fclose when you have finished with a file?

Why should you call fclose when you have finished with a file?

  1. A.To delete the file
  2. B.To flush any data still in the buffer to disk and release the file
  3. C.To move back to the start of the file
  4. D.fclose is only needed for binary files
Answer & explanation

Correct answer: To flush any data still in the buffer to disk and release the file

Without fclose, the last writes may stay in memory and never reach the file if the program ends abnormally.

Can you get the rest right without peeking?

Take the timed Quiz: Files and Preprocessor quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →