Bird
0
0

Which of the following is a correct way to call a parent class constructor using super()?

easy📝 Conceptual Q2 of 15
Python - Inheritance and Code Reuse
Which of the following is a correct way to call a parent class constructor using super()?
Asuper.init()
Bsuper.__init__()
Csuper().parent()
Dsuper().__init__()
Step-by-Step Solution
Solution:
  1. Step 1: Recall the syntax for calling parent constructor

    The parent constructor is called with super().__init__() in Python.

  2. Step 2: Check each option

    Only super().__init__() correctly calls the parent's __init__ method.

  3. Final Answer:

    super().__init__() -> Option D
  4. Quick Check:

    Parent constructor call = super().__init__() [OK]
Quick Trick: Use super().__init__() to call parent constructor [OK]
Common Mistakes:
  • Missing parentheses after __init__
  • Using super.init() without parentheses
  • Confusing super() with class name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes