Home »
MCQs »
Python MCQs
Amongst which of the following is / are the method of convert Python objects for writing data in a binary file?
72. Amongst which of the following is / are the method of convert Python objects for writing data in a binary file?
- set() method
- dump() method
- load() method
- None of the mentioned above
Answer: B) dump() method
Explanation:
The dump() method is used to convert Python objects into binary data that can be written to a binary file. The file into which the data is to be written must be opened in binary write mode before the data can be written. To make use of the dump() method, we can call this function with the parameters data object and file object. There are two objects in this case: data object and file object. The data object object is the object that needs to be dumped to the file with the file handle named file_ object.