Courseiva

PCAP Object-Oriented Programming Practice Question

A parent class defines a method `move()`. A child class overrides `move()` but also needs to call the parent's version inside it. Which syntax allows that?

⚠ Common exam trap

Python Institute often tests the distinction between `super().method()` and calling the parent method by class name, expecting candidates to recognize that `super()` avoids hardcoding and handles multiple inheritance correctly, while `Parent.method(self)` is a valid but less Pythonic alternative that still requires explicit `self`.

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

✓

`super().move()`

`super().move()` is the Python syntax for calling the parent class's `move()` method from within the child class's overridden version. The `super()` function returns a proxy object that delegates method calls to the parent class, following the MRO (Method Resolution Order). This allows the child to extend the parent's behavior without hardcoding the parent class name.

Answer analysis

Option-by-option breakdown

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

  • ✗

    `self.move()`

    Why it's wrong here

    Calling self.move() inside the overridden move method performs an attribute lookup that starts on the child instance's own class, so it finds the child override again instead of the parent's version. This re-invokes the same method body with no base-class call, causing infinite recursion until Python raises a RecursionError. In Python, name resolution follows MRO from the actual class of self, so self cannot implicitly jump to the parent.

  • ✓

    `super().move()`

    Why this is correct

    super().move() constructs a proxy object that starts method resolution in the class hierarchy after the current class, so the call is forwarded to the first matching move defined in that parent chain. Because super() is evaluated with the current class and self injected automatically by the compiler, it requires no explicit self and correctly handles diamond inheritance. It invokes the parent implementation exactly once in the cooperative multiple-inheritance protocol.

  • ✗

    `Parent.move()`

    Why it's wrong here

    This snippet as written is missing the required self argument; Parent.move(self) would invoke the parent method, but passing the instance explicitly is verbose and less robust. As used here, Parent.move() without self raises a TypeError because the function expects an instance argument, and even with self it hardcodes the parent class name, making subclasses brittle. This old-style call bypasses Python's cooperative MRO, so it can skip other classes in a multiple-inheritance chain.

  • ✗

    `ParentClass.move(self)`

    Why it's wrong here

    ParentClass is not a defined name in this scope—unless you have separately created an alias, this line raises a NameError because no class called ParentClass exists in the code your question provides. Even if you renamed it to the actual parent class Parent, calling ParentClass.move(self) merely duplicates the functionality of Parent.move(self) with a nonstandard name. Using a non-existent or hardcoded class reference guarantees the code is wrong or brittle.

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.