PCAP Object-Oriented Programming Practice Question
Consider a class `D` that inherits from multiple base classes `B` and `C`. The developer wants to call a method from a specific parent class while ensuring correct method resolution order (MRO). Which is the safest way?
⚠ Common exam trap
Python Institute often tests the misconception that `super()` only calls the immediate parent class, when in fact it follows the full MRO, and candidates mistakenly choose a hard-coded parent call (like Option B or D) thinking it is more explicit and safer.
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().method()`
In Python, `super().method()` is the safest way to call a method from a parent class in a multiple inheritance scenario because it respects the Method Resolution Order (MRO) defined by the C3 linearization algorithm. This ensures that the method is resolved from the next class in the MRO, avoiding hard-coded references that could break if the inheritance hierarchy changes. It also correctly handles cooperative multiple inheritance, where each class in the MRO can collaborate via `super()` calls.
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.method()`
Why it's wrong here
`self.method()` performs a normal attribute lookup on the instance, so it dispatches to the most-derived override in the MRO rather than a specific parent's version. In multiple inheritance, this gives you no control over which base implementation runs, and if the current override calls `self.method()` again, it will recurse indefinitely. It is useful for polymorphic calls but cannot be used to select a particular parent.
- ✗
`ParentClass.method(self)`
Why it's wrong here
`ParentClass.method(self)` explicitly calls a named parent's method while passing the current instance manually, completely bypassing the MRO. This is fragile because it hard-codes the parent's name and expects that parent to exist, and in a diamond hierarchy it can execute the method more than once or overlook an intermediate class that should run first. It is not a cooperative pattern and breaks as soon as the inheritance layout changes.
- ✓
`super().method()`
Why this is correct
`super().method()` delegates to the next class in the MRO after the current class, not necessarily the immediate parent, which is exactly what cooperative multiple inheritance requires. Python computes the MRO using the C3 linearization algorithm, so every ancestor appears exactly once and after each class's call to `super()`, the chain continues in the correct order. This ensures shared base classes are processed only once and remains correct even when the hierarchy changes.
- ✗
`BaseClass.method(self)`
Why it's wrong here
`BaseClass.method(self)` targets a specific base implementation directly, skipping all intermediate classes that may need to customize or initialize state. If `BaseClass` is a common ancestor in a diamond, this can run the method multiple times because each derived class calls it explicitly instead of relying on the MRO. This approach ignores the cooperative mechanism and invites duplicated side effects.
Visual reference
Go deeper
Related to this question
About these practice questions
This PCAP question is part of Courseiva's 169-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
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.