
Python InstitutePCAP - Certified Associate Python Programmer
Domain 4Objective 6
PCAP-31-03 4.6 Construct and Initialize Objects PCAP-31 Practice Questions (Page 4)
Part of the Object-Oriented Programming domain, which accounts for 34% of the PCAP-31 exam. Python Institute does not publish an official question count, but from its 65-minute exam (~25–45 total, ~9–15 in this domain), expect 2–3 from this objective — we provide 48 practice questions to prepare you well beyond it. (estimate)
48questions here
10free pages
5concepts
34%of the exam
Questions 16–20
- 16
A developer is refactoring a class that currently has __init__(self, name, age). The new requirement is that age should be optional, defaulting to 0. However, existing code calls the constructor with both arguments positionally. Which change will maintain backward compatibility?
Select an answer first - 17
A developer is debugging a class where the __init__ method sets an attribute using self.data = data. However, after creating an instance, the attribute data is not accessible from outside the class. What is the most likely cause?
Select an answer first - 18
A developer is designing a base class that should not be instantiated directly, but subclasses should be able to define their own __init__. The base class has no __init__. What is the best way to prevent direct instantiation of the base class?
Select an answer first - 19
A developer is using a third-party class that has an __init__ method with a required parameter 'token'. The developer wants to create an instance but does not know the token value until runtime. Which approach is best?
Select an answer first - 20
A developer is creating a class with an __init__ method that has a parameter named 'self'. The developer wants to use a different name for the instance reference. Is this possible?
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. “PCAP-31” is a trademark of its owner, used for identification only.