← Quiz: Files and Preprocessor: all 10 questions
Quiz: Files and Preprocessor · Question 7 of 10
What happens when you open an existing file with mode "w"?
What happens when you open an existing file with mode "w"?
- A.New data is added at the end
- B.Its old contents are erased
- C.fopen returns NULL
- D.The file is opened read-only
Answer & explanation
Correct answer: Its old contents are erased
"w" creates or truncates; use "a" to keep the contents and append.
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 →