151. Which of the following Python codes will result in an error?
object = ‘a’
a) >>> pickle.dumps(object)
b) >>> pickle.dumps(object, 3)
c) >>> pickle.dumps(object, 3, True)
d) >>> pickle.dumps(‘a’, 2)
152. Which of the following functions can be used to find the protocol version of the pickle module currently being used?
a) pickle.DEFAULT
b) pickle.CURRENT
c) pickle.CURRENT_PROTOCOL
d) pickle.DEFAULT_PROTOCOL
153. The output of the following two Python codes is exactly the same.
object
‘a’
CODE 1
>>> pickle.dumps(‘a’, 3)
CODE 2
>>> pickle.dumps(object, 3)
a) True
b) False
154. Which of the following functions can accept more than one positional argument?
a) pickle.dumps
b) pickle.loads
c) pickle.dump
d) pickle.load
155. Which of the following functions raises an error when an unpicklable object is encountered by Pickler?
a) pickle.PickleError
b) pickle.PicklingError
c) pickle.UnpickleError
d) pickle.UnpicklingError
156. The pickle module defines ______ exceptions and exports _______ classes.
a) 2, 3
b) 3, 4
c) 3, 2
d) 4, 3
157. Which of the following cannot be pickled?
a) Functions which are defined at the top level of a module with lambda
b) Functions which are defined at the top level of a module with def
c) Built-in functions which are defined at the top level of a module
d) Classes which are defined at the top level of a module
158. If __getstate__() returns _______________ the __setstate__() module will not be called on pickling.
a) True value
b) False value
c) ValueError
d) OverflowError
159. Lambda functions cannot be pickled because:
a) Lambda functions only deal with binary values, that is, 0 and 1
b) Lambda functions cannot be called directly
c) Lambda functions cannot be identified by the functions of the pickle module
d) All lambda functions have the same name, that is, <lambda>
160. The module _______________ is a comparatively faster implementation of the pickle module.
a) cPickle
b) nPickle
c) gPickle
d) tPickle
161. The copy module uses the ___________________ protocol for shallow and deep copy.
a) pickle
b) marshal
c) shelve
d) copyreg