← 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 →- Q1. What does fopen return if the file can't be opened?
- Q2. What does this print? (code)
- Q3. Which mode adds data to the end of an existing file?
- Q4. What is the purpose of a header guard (ifndef … define … endif)?
- Q5. When does the preprocessor run?
- Q6. What does this print? (code)
- Q7. What happens when you open an existing file with mode "w"?
- Q8. Which function reads a whole line of text, including spaces, from a file?
- Q9. What does this print? (code)
- Q10. Why should you call fclose when you have finished with a file?