Bird
0
0

Which of the following is the correct syntax to call a parent class method greet inside a child class method using super()?

easy📝 Syntax Q12 of 15
Python - Inheritance and Code Reuse
Which of the following is the correct syntax to call a parent class method greet inside a child class method using super()?
Asuper().greet()
Bsuper->greet()
Csuper[greet]()
Dsuper.greet()
Step-by-Step Solution
Solution:
  1. Step 1: Recall the syntax of super()

    The correct way to call a parent method is using super() followed by dot and method name.
  2. Step 2: Match the correct option

    Only super().greet() uses the right parentheses and dot notation.
  3. Final Answer:

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

    Use parentheses with super() = D [OK]
Quick Trick: super() always needs parentheses before method call [OK]
Common Mistakes:
  • Omitting parentheses after super
  • Using square brackets instead of parentheses
  • Using arrow notation which is invalid in Python

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes