Examveda

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: Option D


Join The Discussion

Related Questions on Concept of Object Oriented Programs in Python