Courseiva

PCPP2 · domain

Advanced OOP And Performance

Practise Python Institute Certified Professional in Python Programming 2 (PCPP2) (PCPP2) Advanced OOP And Performance practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.

32 questions8 easy12 medium12 hard

Focused practice

Practice Advanced OOP And Performance questions

Scored sessions drawing only from this domain — pick a length below.

Start 20-question practice test →

What this domain covers

What to know about Advanced OOP And Performance

Advanced OOP And Performance questions test whether you can apply the concept in context, not just recognise a definition.

How the topic appears in realistic exam-style scenarios.

Which detail in the question changes the correct answer.

How to eliminate plausible but wrong options.

How to connect the question back to the wider exam objective.

Watch out for

Common Advanced OOP And Performance exam traps

  • Answering from memory before reading the full scenario.
  • Missing a constraint such as cost, availability, security, scope or command context.
  • Choosing a broad answer when the question asks for the most specific fix.
  • Ignoring why the wrong options are tempting.

Question index

All Advanced OOP And Performance questions (32)

Click any question to see the full explanation, or start a practice session above.

1

You are utilizing abstract base classes (ABCs). How do you enforce that a subclass implements a specific method?

Hard
2

You need to prevent an object's attribute from being modified after it is set. Which approach provides the most robust implementation?

Hard
3

You have an object that behaves like a function. Which magic method must be implemented to make this possible?

Medium
4

You need to ensure that a class can only be instantiated once throughout the application lifecycle. Which design pattern is most appropriate?

Easy
5

When managing resources like file handles, what is the best practice to ensure they are always closed?

Easy
6

When using inheritance, how can you explicitly call a method from a specific parent class that is not the immediate superclass?

Medium
7

You need to implement a custom class that behaves like a sequence, allowing indexing and length checking. Which magic methods are required?

Hard
8

In a multi-threaded application, you need to ensure that shared state is modified safely. Which tool is the most appropriate for this task?

Hard
9

When writing a metaclass, what is the 'cls' parameter in the __new__ method referring to?

Hard
10

Which THREE of the following are features of the 'threading' module in Python?

Hard
11

Which operator is used to perform bitwise AND operations?

Easy
12

You are handling large datasets and want to improve memory efficiency. Which Python feature allows you to iterate over a large sequence without loading it entirely into memory?

Medium
13

Which magic method is used to define how an object is displayed for developers (for debugging)?

Easy
14

Which keyword is used to raise an exception in Python?

Easy
15

You are designing a class hierarchy where a subclass needs to ensure it calls the constructor of its parent in a multiple inheritance scenario. Which mechanism is the standard Pythonic approach to handle this dynamically?

Medium
16

Which TWO of the following are valid ways to create a generator in Python?

Medium
17

You need to ensure that a method can be called on the class directly, without requiring an instance. Which decorator should be used?

Medium
18

Which TWO of the following are true about the 'descriptor protocol' in Python?

Hard
19

You need to compare two objects for equality based on a custom attribute. Which method should you override?

Medium
20

When writing a context manager using the @contextlib.contextmanager decorator, what should the function do to pass a value to the 'as' clause?

Medium
21

You are using 'slots' to save memory. What is a significant side effect of defining __slots__ in a class?

Hard
22

You want to store an object in a set. What must the object implement?

Medium
23

You are profiling your code and identify that a specific method is called millions of times. You decide to use a descriptor to optimize attribute access. What must the descriptor implement to intercept attribute assignment?

Hard
24

When optimizing Python code, which tool should you use to identify hot spots in the execution path?

Easy
25

Which TWO of the following are Python object-oriented concepts?

Easy
26

Which THREE of the following are true about Python metaclasses?

Hard
27

You have a performance-critical application using heavy objects. You want to reduce memory footprint by preventing the creation of __dict__ for every instance. How should you proceed?

Hard
28

You need to dynamically add methods to a class at runtime. Which mechanism allows you to modify the class object before it is fully constructed?

Medium
29

Which built-in function allows you to retrieve an attribute from an object by its string name?

Easy
30

Which THREE of the following can be used to improve the performance of a Python application?

Medium
31

Which TWO of the following statements about the Python Method Resolution Order (MRO) are true?

Hard
32

Which THREE of the following are benefits of using __slots__?

Medium

Frequently asked questions

What does the Advanced OOP And Performance domain cover on the PCPP2 exam?
Advanced OOP And Performance questions test whether you can apply the concept in context, not just recognise a definition.
How many questions are in this domain?
This page lists all 32 Advanced OOP And Performance questions in the PCPP2 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
What is the best way to practise this domain?
Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
Can I practise only Advanced OOP And Performance questions?
Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.
python-pcpp2 PYTHON-PCPP2 advanced oop and performance Practice Questions