Question: PYTHON Homework 4 Could you please help me answer these questions? 21.) The pickle module implements a fundamental, but powerful algorithm for serializing and de-serializing

PYTHON Homework 4 Could you please help me answer these questions?

21.) The pickle module implements a fundamental, but powerful algorithm for serializing and de-serializing a Python object structure.

a.) true

b.) false

22.) A(n) ____ class includes data and methods common to its subclasses, but is never instantiated.

a.) polymorphic

b.) abstract

c.) encapsulated

d.) anonymous

23.) Python's ____ function is used to determine whether or not two objects are of the same type.

a.) is

b.) type

c.) in

d.) eq

24.) What method name is used for a constructor?

a.) __begin__

b.) __construct__

c.) __create__

d.) __init__

25.) When pickling several different objects in the same file, when you retrieve the items you need to load them in the same order they were dumped in.

a.) true

b.) false

26.) Consider the following class. Which method(s) are mutators?

class Counter :

def getValue(self) :

return self._value

def click(self) :

self._value = self._value + 1

def unClick(self) :

self._value = self._value - 1

def reset(self) :

self._value = 0

a.) Only reset

b.) Only click and unClick

c.) Only click, unClick and reset

d.) All four methods are mutators

27.) Which of the following is NOT true about constructors?

a.) A constructor initializes the instance variables of an object

b.) The constructor is automatically called when an object is created

c.) The constructor is defined using the special method name __default__

d.) Default arguments can be used with a constructor to provide different ways of creating an object

28.) When is a constructor invoked?

a.) When an object is created

b.) When instance data is modified

c.) When a method is invoked

d.) When multiple arguments are required to create an object

29.) Before invoking a method on an object, the object must have first been instantiated.

a.) true

b.) false

30.) Assume a class exists named Fruit. Which of the follow statements constructs an object of the Fruit class?

a.) def Fruit()

b.) class Fruit()

c.) x = Fruit()

d.) x = Fruit.create()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!