A Place for Latest Exam wise Questions, Videos, Previous Year Papers, Study Stuff for MCA Examinations - NIMCET
Previous Year Question (PYQs)
2
What is the correct file mode that opens preexisting file in read and write mode?
Solution
Solution:
- `"r+b"` or `"rb+"` → open **existing file** for both reading and writing (no truncation).
- `"w+b"` or `"wb+"` → open file for reading and writing but **creates/truncates** file.
- `"ab"` → append binary mode.
Hence, the correct mode for **existing file in read-write** is `"r+b"`.
Online Test Series, Information About Examination, Syllabus, Notification and More.