Vidyalelo
Python · Q52

Concept of Object Oriented Programs in Python

Programming · Python · question 52

Q52

What will be the output of the following Python code? class A: def __init__(self, x= 1): self.x = x class der(A): def __init__(self,y = 2): super().__init__() self.y = y def main(): obj = der() print(obj.x, obj.y) main()

A.
Error, the syntax of the invoking method is wrong
B.
The program runs fine but nothing is printed
C.
1 0
D.
1 2
Answer

Answer: Option D

Solution

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