← Quiz: Python OOP: all 15 questions
Quiz: Python OOP · Question 7 of 15
What does this print? (code)
What does this print?
class A:
def hi(self):
return "A"
class B(A):
pass
print(B().hi())
- A.A
- B.B
- C.None
- D.An error
Answer & explanation
Correct answer: A
B inherits hi from A.
Can you get the rest right without peeking?
Take the timed Quiz: Python OOP quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →