Courseiva

PCPP1 · topic practice

Advanced Object Oriented Programming practice questions

This domain of the PCPP1 exam covers Python's advanced object-oriented machinery: design patterns such as Factory and Singleton, class and static methods, metaclasses, multiple inheritance and MRO, abstract base classes, and memory/attribute control through __slots__. Questions are code-reading and behavior-prediction items: you must reason about what Python actually does at runtime, not just name a concept.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Editorial oversight:Johnson Ajibi· MSc IT Security, IEEE Senior Member
20 questionsDomain: Advanced Object Oriented Programming

What the exam tests

What to know about Advanced Object Oriented Programming

You must read Python class code and predict runtime behavior: method binding, MRO, __slots__ effects, and pattern roles. The single most important thing is knowing exactly what each construct does at runtime, especially classmethod binding and cooperative super() calls in multiple inheritance.

The Factory pattern: what a concrete factory implements versus an abstract factory interface

@classmethod versus @staticmethod: binding to the class, first argument, and inheritance behavior

__slots__ inheritance: whether a child without its own __slots__ still gets a __dict__

Multiple inheritance: MRO resolution and the consequence of skipping super().__init__()

Why learners struggle

Why Advanced Object Oriented Programming questions are commonly missed

RAM questions are commonly missed because learners confuse physical form factors (DIMM vs SO-DIMM) and fail to distinguish between memory speed (MHz) and latency (CL).

  • ·DIMM vs SO-DIMM — desktop vs laptop form factor confusion
  • ·DDR3 vs DDR4 vs DDR5 — notch position and voltage differences
  • ·MHz vs CL — speed vs latency trade-offs in performance
  • ·Single-channel vs dual-channel — bandwidth impact misconception
  • ·ECC vs non-ECC — error correction support in servers vs desktops
  • ·32-bit vs 64-bit — maximum addressable RAM limit

Watch out for

Common Advanced Object Oriented Programming exam traps

  • ▸Assuming a child class inherits the parent's __slots__ restriction; a child without __slots__ regains a __dict__ and allows new attributes.
  • ▸Confusing @classmethod with @staticmethod: only the classmethod receives the class as its implicit first argument and follows inheritance.
  • ▸Forgetting that omitting super().__init__() in a cooperative multiple-inheritance chain leaves later base classes uninitialized, causing missing attributes.

Practice set

Advanced Object Oriented Programming questions

20 questions · select your answer, then reveal the explanation

In the context of the Descriptor Protocol, what is the primary difference between a data descriptor and a non-data descriptor?

You are implementing a Singleton pattern using the __new__ method. Why is it considered best practice to also define a __call__ method in the metaclass or use a decorator instead of just overriding __new__ in the base class?

Consider a class that uses a metaclass to automatically register subclasses in a dictionary. If you want to prevent the base class itself from being registered, how should the metaclass be implemented?

What happens if you use a decorator on a class that returns a modified version of the class?

Which THREE of the following statements are correct about Python metaclasses?

Which THREE of the following are true about the Python descriptor protocol?

You are reviewing a class `BankAccount` that uses a private attribute `__balance`. A colleague writes a subclass `SavingsAccount` and tries to access `self.__balance` directly, but receives an `AttributeError`. Which statement best explains why this occurs and how to correctly access the balance from the subclass?

You are implementing a class `Vector` that supports addition of two vectors. You want `v1 + v2` to return a new `Vector`, and you also want `v1 + 5` to be valid by treating 5 as a scalar and adding it to each component. A colleague suggests implementing `__add__` to handle both cases. Which implementation strategy is most appropriate?

You are implementing a custom descriptor to validate that an attribute is always a positive number. The descriptor is assigned to a class attribute. Which TWO of the following statements are correct about how descriptors work in this scenario? (Choose two.)

You are designing a plugin system where each plugin is a subclass of `PluginBase`. You want to automatically register each plugin subclass at the time the subclass is defined, without requiring explicit registration calls. You decide to use `__init_subclass__`. Which two statements are correct about using `__init_subclass__` for this purpose? (Choose two.)

You are reviewing a class that uses multiple inheritance. The class `Child` inherits from `Base1` and `Base2`, both of which define a method `greet()`. You want `Child.greet()` to call both parent implementations in the order they appear in the MRO. Which code correctly achieves this?

A developer is comparing `__init_subclass__` and metaclasses for customizing subclass creation. They want to choose the lighter-weight mechanism when possible. Which two statements correctly describe advantages of `__init_subclass__` over defining a custom metaclass in this context? (Choose two.)

You are creating a class `Config` that should allow attribute access via both dot notation and dictionary-style keys, e.g., `config.host` and `config['host']`. You also want to prevent adding new attributes after initialization. Which combination of magic methods should you implement?

A framework defines an abstract base class `Shape` using `abc.ABC` with an abstract method `area`. A developer writes a subclass `Circle` that implements `area` but also wants to prevent `Circle` itself from being instantiated directly, requiring users to subclass `Circle` further. Which two techniques achieve that goal while preserving the abstract contract? (Choose two.)

You are implementing a class `Logger` that should ensure only one instance exists throughout the application. You decide to use the `__new__` method to control instantiation. Which implementation correctly enforces the singleton pattern while allowing subclassing?

How do you correctly call a method from a sibling class in a diamond inheritance structure using super()?

Which magic method is responsible for providing the informal string representation of an object, typically used for user-facing output?

What is the result of applying the @staticmethod decorator to a method inside a class that also defines a metaclass?

You are implementing the Observer pattern. Why should you avoid using a strong reference to the observers in the subject's list?

When using abstract base classes (ABCs) from the abc module, what happens if a class inherits from an ABC but fails to implement one of the abstract methods?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Advanced Object Oriented Programming sessions

Start a Advanced Object Oriented Programming only practice session

Every question in these sessions is drawn from the Advanced Object Oriented Programming domain — nothing else.

Related practice questions

Related PCPP1 topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the PCPP1 exam test about Advanced Object Oriented Programming?
You must read Python class code and predict runtime behavior: method binding, MRO, __slots__ effects, and pattern roles. The single most important thing is knowing exactly what each construct does at runtime, especially classmethod binding and cooperative super() calls in multiple inheritance.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Advanced Object Oriented Programming questions in a focused session?
Yes — the session launcher on this page draws every question from the Advanced Object Oriented Programming domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other PCPP1 topics?
Use the topic links above to move to related areas, or go back to the PCPP1 question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the PCPP1 exam covers. They are not copied from any real exam or dump site.