Courseiva

PCAP Object-Oriented Programming Practice Question

Which THREE statements about the Python method resolution order (MRO) are true? (Select exactly 3.)

⚠ Common exam trap

Python Institute often tests the misconception that MRO is determined dynamically at runtime (option A) or that Python still uses a simple depth-first left-to-right algorithm (option D), when in fact Python 3 exclusively uses the C3 linearization algorithm computed at class definition time.

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 MRO of a class can be viewed using the __mro__ attribute.

The `__mro__` attribute on a class returns a tuple of classes in the exact order that Python uses to resolve methods and attributes. This attribute is computed at class definition time using the C3 linearization algorithm, and it provides a direct, read-only view of the resolution order for that class.

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 MRO is determined at runtime when a method is called.

    Why it's wrong here

    The MRO is not computed at runtime when a method is called. Instead, Python eagerly builds the method resolution order at class definition time and stores it as a tuple in the class's __mro__ attribute. Method calls simply traverse that precomputed sequence, so the linearization never changes during program execution.

  • ✓

    The MRO of a class can be viewed using the __mro__ attribute.

    Why this is correct

    Every Python class exposes a read-only __mro__ attribute that is a tuple of classes in the exact order Python will search for attributes and methods. The tuple starts with the class itself, then its ancestors in C3-linearized order, and ends with object. This attribute is the canonical way to inspect the method resolution order, for example by printing MyClass.__mro__.

  • ✓

    C3 linearization is the algorithm used for MRO in Python 3.

    Why this is correct

    Python 3 uses the C3 linearization algorithm to compute the MRO of every class, a scheme introduced in Python 2.3 for new-style classes. C3 produces a unique, monotonic order that respects the local precedence of direct bases and ensures a subclass always precedes its ancestors. This solves the fragile base class problem and prevents the surprising ordering that older depth-first methods produced in diamond-shaped hierarchies.

  • ✗

    Python uses a depth-first left-to-right algorithm for MRO.

    Why it's wrong here

    Depth-first left-to-right traversal was the rule for old-style classes in Python 2, but it is not used in Python 3. New-style and Python 3 classes rely on C3 linearization, which can reorder classes in complex multiple-inheritance graphs so that a common base class appears after every subclass that depends on it. As a result, the statement describes an obsolete algorithm, not the behavior of modern Python.

  • ✓

    super() uses the MRO to determine which method to call.

    Why this is correct

    The super() built-in relies entirely on the MRO to locate the next class in the resolution order after the class from which it is called. That means super().method() invokes the method belonging to the next class in the MRO, not necessarily the immediate parent class. This behavior enables cooperative multiple inheritance, where each class in the MRO can deliberately call further up the chain.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

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.