🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Files and Preprocessor: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does fopen return if the file can't be opened?
  2. Q2. What does this print? (code)
  3. Q3. Which mode adds data to the end of an existing file?
  4. Q4. What is the purpose of a header guard (ifndef … define … endif)?
  5. Q5. When does the preprocessor run?
  6. Q6. What does this print? (code)
  7. Q7. What happens when you open an existing file with mode "w"?
  8. Q8. Which function reads a whole line of text, including spaces, from a file?
  9. Q9. What does this print? (code)
  10. Q10. Why should you call fclose when you have finished with a file?