
Python InstitutePCPP1 - Certified Professional Python Programmer 1
Domain 1Objective 8
PCPP-32-101 1.8 Apply Subclassing of Built-In Classes PCPP-32-1 Practice Questions (Page 1)
Part of the Advanced Object-Oriented Programming domain, which accounts for 35% of the PCPP-32-1 exam. Python Institute does not publish an official question count, but from its 65-minute exam (~25–45 total, ~9–16 in this domain), expect 1–1 from this objective — we provide 21 practice questions to prepare you well beyond it. (estimate)
21questions here
5free pages
5concepts
35%of the exam
Questions 1–5
- 1
A developer creates a subclass of dict that automatically converts all keys to strings. They override __setitem__ to store str(key). They also override __getitem__ to look up with str(key). When they use the .get() method with a non-string key, it returns None even though the key exists as a string. What is the cause?
Select an answer first - 2
When subclassing str to create a custom string type, which method would you override to change how the string is displayed when printed?
Select an answer first - 3
A developer needs a dictionary that automatically converts all values to strings when stored. They subclass dict and override __setitem__ to store str(value). They also override update() to normalize values. When they use the .setdefault() method with a non-string default, the stored value is not converted. Why?
Select an answer first - 4
In a subclass of dict, how would you correctly call the parent's __init__ method to initialize the dictionary?
Select an answer first - 5
A developer needs a dictionary that automatically creates a default value when a missing key is accessed. They subclass dict and override __missing__. They test it with d['new_key'] and it works. However, when they use d.setdefault('new_key', 0), the default is not created. Why?
Select an answer first
Finished these 5 questions?
Review the revealed explanations, or continue through the curriculum.
Free Basic Practice is a study aid with revealable answers — not a scored exam. Examers.io is independent and not affiliated with or endorsed by Python Institute. “PCPP-32-1” is a trademark of its owner, used for identification only.