Class - 12 CBSE Computer Science — Assertion Reason Type Questions
Assertion (A): To work with binary files, we need to import pickle module.
Reasoning (R): Pickle module contains two important methods for reading and writing data to binary files, i.e., load() and dump() respectively.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Python Data Handling
1 Like
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
To work with binary files in Python, we indeed need to import the pickle module. The pickle module is used for serializing and deserializing Python objects and contains two important methods, load() and dump(), for reading and writing data to binary files, respectively.
Answered By
2 Likes