What is the function of the mode ‘ w+’?

Category: QuestionsWhat is the function of the mode ‘ w+’?
Editor">Editor Staff asked 11 months ago

What is the function of the mode ‘ w+’?
 
(a) create text file for writing, discard previous contents if any
 
(b) create text file for update, discard previous contents if any
 
(c) create text file for writing, do not  discard previous contents if any
 
(d) create text file for update, do not discard previous contents if any
 
I had been asked this question in semester exam.
 
I’m obligated to ask this question of File Operations in division Input and Output in C of C
NCERT Solutions for Subject Computer science (C Programming) Select the correct answer from above options 
Interview Questions and Answers, Database Interview Questions and Answers for Freshers and Experience

1 Answers
Editor">Editor Staff answered 11 months ago

Right answer is (b) create text file for update, discard previous contents if any
 
The best explanation: w+ is a mode used to open a text file for update (i. e., writing and reading), discard previous contents if any.