Question: Consider a Python class defined as follows, where _ _ status is defined as a private instance attribute. Which of the following statements is /

Consider a Python class defined as follows, where __status is defined as a private instance attribute. Which of the following statements is/are correct about this class definition? Please note that there might be more than one correct statement, and you must choose all correct statements to receive full credit for this question.
class House:
num_houses =0
house_type =['SF','MF']
def __init__(self, sqft, price, status):
self.area = sqft
self.price = price
self.status = status
House.num_houses +=1
@property
def status(self):
return self.__status
@status.setter
def status(self, val):
if val in House.house_type:
self.__status = val
else:
raise ValueError('The status of the house can only be "SF" or "MF".')
house1= House(1400,140000,'SF')
house2= House(2000,220000,'MF')
House.num_houses +=1
house1.num_houses +=1
house1.house_type +=['2F']
house1.__status ='MF'
house1._House__status ='MF'
house1.status ='MF'
Group of answer choices
The expression "house1._House__status ='MF'" will update the value of the private attribute __status for object house1.
The expression "house1.house_type +=['2F']" will update the value of the class attribute "house_type" for all objects of this class, including house2.
The expression "House.num_houses +=1" will increment the value of the class attribute "num_houses" for all objects of this class, including house2.
The expression "house1.__status ='MF'" will update the value of the private attribute __status for object house1.
The property called status is a read-only property.
The expression "house1.num_houses +=1" will increment the value of the class attribute "num_houses" for all objects of this class, including house2.
The expression "house1.status ='MF'" will update the value of the private attribute __status for object house1.

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 Programming Questions!