Bird
0
0

Which of the following is the correct way to call a parent class method greet from a child class in Python?

easy📝 Syntax Q3 of 15
Python - Inheritance and Code Reuse
Which of the following is the correct way to call a parent class method greet from a child class in Python?
Acall Parent.greet()
BParent.greet()
Csuper().greet()
Dself.greet()
Step-by-Step Solution
Solution:
  1. Step 1: Recall how to call parent methods

    In Python, super() is used to access parent class methods from child.
  2. Step 2: Check options

    super().greet() uses super().greet(), which is correct syntax.
  3. Final Answer:

    super().greet() -> Option C
  4. Quick Check:

    Use super() to call parent methods [OK]
Quick Trick: Use super() to access parent methods inside child [OK]
Common Mistakes:
  • Calling parent method without super()
  • Using incorrect syntax like 'call Parent.greet()'
  • Confusing self.greet() with parent method call

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes