What will be the output of following Python code?

class Base:
    def __init__(self, num):
        self.n1 = num

class Child(Base):
    def __init__(self, num):
        self.n2 = num

oC = Child(12)
print(oC.n1, oC.n2)

 

None 12
12 None
12 12
AttributeError: child instance has no attribute 'n1'.
Verified Answer
Correct Option - d

To get all Infosys Certified Python Programmer Exam questions Join Telegram Group https://rebrand.ly/lex-group-70b557

Telegram

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in

Updated on Fri, 22 Aug 2025