Vidyalelo
Python · Q26

Concept of Object Oriented Programs in Python

Programming · Python · question 26

Q26

What will be the output of the following Python code? class A: def __str__(self): return '1' class B(A): def __init__(self): super().__init__() class C(B): def __init__(self): super().__init__() def main(): obj1 = B() obj2 = A() obj3 = C() print(obj1, obj2,obj3) main()

A.
1 1 1
Answer
B.
1 2 3
C.
'1' '1' '1'
D.
An exception is thrown

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board