Computer Science
Assertion. 'Pickling' is the process whereby a Python object hierarchy is converted into a byte-stream.
Reason. A binary file works with byte-streams.
Python File Handling
2 Likes
Answer
(b)
Both Assertion and Reason are true but Reason is not the correct explanation of Assertion.
Explanation
A binary file works with byte-streams and 'Pickling' is the process in binary file, where a Python object hierarchy is converted into a byte-stream. Binary files are commonly used as the destination for pickled data. This is because binary files can efficiently store raw binary data, including the byte-streams produced by pickling.
Answered By
3 Likes
Related Questions
Assertion. The file modes "r", "w", "a" work with text files, CSV files and TSV files alike.
Reason. The CSV and TSV are types of delimited text files only.
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.
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.
Assertion. Every open file maintains a file-pointer and keeps track of its position after every operation.
Reason. Every read and write operation takes place at the current position of the file pointer.