Courseiva
Object-Oriented Programming →mediumMultiple Select

How Method Overriding Works in Python: super() and Same Method Name

Which TWO statements about method overriding in Python are correct?

⚠ Common exam trap

Python Institute often tests the misconception that Python enforces strict method signatures or requires an `@override` decorator, leading candidates to select options D or C, when in fact Python's dynamic nature allows flexible overriding without compile-time checks.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

The overriding method can call the parent method using super()

The overriding method can call the parent class's version of the method using the built-in `super()` function, which returns a proxy object that delegates method calls to the parent class. This is a fundamental feature of Python's inheritance mechanism, allowing the child method to extend or modify the parent's behavior while still invoking it.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    The overriding method can call the parent method using super()

    Why this is correct

    In a subclass, super() returns a proxy bound to the parent classes in the method resolution order, allowing the overriding method to explicitly invoke the version it replaced. Calling super().method(*args) inside the override is idiomatic when you want to extend, rather than completely replace, the inherited behavior. This capability does not make super() mandatory; a subclass may fully override a method without calling its parent at all.

  • ✓

    The overriding method must have the same name

    Why this is correct

    The defining requirement for overriding is that the subclass declares a method with exactly the same identifier as an inherited method. When an attribute is looked up on an instance, Python finds the first matching name in the method resolution order, so the subclass's method shadows the parent's version. If the name differs, you are simply adding a new method, not overriding an existing one.

  • ✗

    The overriding method requires explicit use of the @override decorator

    Why it's wrong here

    Java's @Override annotation is a compile-time check, but Python has no such built-in decorator and no compiler to enforce it. A method overrides a parent method purely by name and inheritance; explicit annotations are optional and only exist if you define them yourself or use frameworks. Therefore, claiming an override decorator is required confuses language-enforced static checks with Python's dynamic dispatch model.

  • ✗

    The overriding method must have the exact same parameter list

    Why it's wrong here

    Python does not perform signature compatibility checks at class definition time, so an overriding method may have a completely different parameter list, including using *args and **kwargs to absorb arbitrary arguments. The only real constraint is that callers holding a reference to the base class may invoke the method with the base signature, so changing parameters can break those call sites. Thus the language permits differing signatures, though Liskov substitution recommends keeping them compatible.

  • ✗

    Overriding is resolved at compile time

    Why it's wrong here

    Compile-time resolution would mean the compiler binds the method to a specific class before the program runs, which is impossible in Python because name lookup is deferred until execution. At runtime, the interpreter traverses the instance's method resolution order to find the first implementation, so a variable typed as the base class still dispatches to the subclass's override. This dynamic dispatch is what makes polymorphism work in interpreted Python.

About these practice questions

One of 421 original PCAP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCAP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCAP exam.