Courseiva
Object-Oriented Programming →mediumMultiple Choice

PCAP Object-Oriented Programming Practice Question

Given the following code: class Parent: def show(self): print('Parent') class Child(Parent): def show(self): print('Child') c = Child(); c.show(); super(Child, c).show(). What is the output?

⚠ Common exam trap

Python Institute often tests the order of execution when `super()` is used with an overridden method, trapping candidates who think `super()` always calls the immediate parent without considering the MRO or who confuse the output order of the two `show()` calls.

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

✓

Child Parent

The code first calls `c.show()`, which invokes the overridden `show()` method in the `Child` class, printing 'Child'. Then `super(Child, c).show()` calls the `show()` method of the `Parent` class (the superclass of `Child`) on the same instance `c`, printing 'Parent'. Thus the output is 'Child Parent'.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Parent Child

    Why it's wrong here

    This option reverses the actual chronological order of execution. When show() is called on a Child instance, Python finds Child.show() first because it overrides Parent.show(), so "Parent" cannot be printed before "Child" — the parent method is not even touched until Child.show() explicitly calls super().show() on its second line. Therefore the output cannot begin with "Parent".

  • ✓

    Child Parent

    Why this is correct

    This is the correct output. The Child class overrides Parent.show(), so invoking show() on a Child instance dispatches to Child.show() first, printing "Child"; the very next statement in Child.show() is super().show(), which resolves through the method resolution order to Parent.show() and prints "Parent". The override explicitly delegates upward, so the two print calls occur in exactly this order.

  • ✗

    Child Child

    Why it's wrong here

    This option would require the second print to also come from Child.show(), but that is impossible because super().show() does not look up Child.show() again. Inside Child.show(), super() returns a proxy that starts the method search at the class after Child in the MRO — namely Parent — so the second call invokes Parent.show(), printing "Parent", not "Child". No recursion or repeated call to Child.show() occurs.

  • ✗

    Parent Parent

    Why it's wrong here

    This option would be plausible only if the first method called were Parent.show(), but Python's dynamic lookup on the Child instance finds the overridden Child.show() first. The parent's print statement is executed only as a result of the explicit super() call that appears after Child's own print, so the initial output line is "Child". Thus the sequence where both lines are "Parent" simply does not match the code's control flow.

About these practice questions

Courseiva writes every PCAP question from scratch — 421 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.