CBSE Class 12 Computer Science Question 5 of 145

File Handling — Question 5

Back to all questions
5
Question

Question 5

Assertion. 'Pickling' is the process whereby a Python object hierarchy is converted into a byte-stream.

Reason. Pickling process is used to work with binary files as a binary file works with byte-streams.

Answer

(b)

Both Assertion and Reason are true but Reason is not the correct explanation of Assertion.

Explanation

"Pickling" is the process whereby a Python object hierarchy is converted into a byte-stream. Pickling process is used to work with binary files as a binary file works with byte-streams. This is because binary files can efficiently store raw binary data, including the byte-streams produced by pickling. The use of binary files is just one of the many possible applications of pickling, but not the primary reason for its existence.