1.

Answer the question (i) to (iv) based on the following:Class Shop (object):Class shop_(self) :self . no_of _employees = 0self. no_of _brands= 0def getSdate (self) :self. no_of_employees=input(“Number of employees”)self.no_of_brands=input(”Number of brands”)def showSdate (self) :Print self.no of employeesPrint self.no of brands class Brand (object) :def init_(self) :self.name = ” ”self.category=(“Mens”, “Womens”, “Kids”)self.avgprice=0, 0def getdate (self) :self.name = raw_input(“Enter Brand Name”)self.avgprice = input(”Enter Average Price”)def showdate (self) :Print self, namePrint self, categoryPrint self, avgpriceClass Mall (Brand, Shop) :def showdate (self) :self.no of shops = 0def getdate (self) :super (mall, self).getSdate ( ) # Statementsuper (mall, self).getdate ( ) # Statement 2self.no_of_shops=input (“Enter number of shops”)def showdata(self)print self.no_of_shopsprint self.no of brands # Blank 11. Which type of inheritance is demonstrated in the above code?2. Explain Statement 1 and 2.3. Name the methods that are overridden along with their class name.4. Fill Blank 1 with a statement to display variable category of class Brand.

Answer»

1. Multiple Inheritance

2. Statement 1 and 2 invoke the getSdate() function of class shop and getData() function of class Brand respectively.

3. getdata() method of class Brand is overridden. When object of class Mall is created.

M=Mall ( )

k.getdata ( )

getdate( ) methodof class Mall is invoked and not of class Brand is called.

4. print Brand ( ). category



Discussion

No Comment Found