Class - 12 CBSE Computer Science — Assertion Reason Type Questions
Assertion. The file modes "r", "w", "a" also reveal the type of file these are being used with.
Reason. The binary file modes have 'b' suffix with regular file modes.
Python File Handling
1 Like
Answer
(a)
Both Assertion and Reason are true and Reason is the correct explanation of Assertion.
Explanation
When we see file modes like "r", "w", or "a" being used in code, it often implies operations on text files. These modes are commonly associated with reading from, writing to, or appending text data in files. In Python, binary file modes are distinguished from text file modes by appending 'b' suffix to the regular file modes. For example, 'rb', 'wb', 'ab'. The presence of the 'b' suffix indicates that the file is being opened in binary mode, suggesting operations involving binary data.
Answered By
1 Like