MCQs > IT & Programming > Python > Output of the following Python code? class X(object): def __init__(self,a): self.num = a def dbup(self): self.num *= 2 class Y(X): def __init__(self,a): X.__init__(self, a) def tpup(self): self.num*= 3 obj = Y(4) print(obj.num*2/1) obj.dbup() print(obj.num*3/2) obj.tpup() print(obj.num/2*3)

Python MCQs

What will be the correct output of the following Python code?

class X(object):

def __init__(self,a):

    self.num = a

def dbup(self):

    self.num *= 2

class Y(X):

def __init__(self,a):

    X.__init__(self, a)

def tpup(self):

    self.num*= 3

obj = Y(4)

print(obj.num*2/1)

obj.dbup()

print(obj.num*3/2)

obj.tpup()

print(obj.num/2*3)


Answer

Correct Answer:

8.0

12.0

36.0  


Explanation:

Note: This Question is unanswered, help us to find answer for this one

Python Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Python Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it