
Python InstitutePCAP - Certified Associate Python Programmer
Domain 4Objective 3
PCAP-31-03 4.3 Equip a Class with Methods PCAP-31 Practice Questions (Page 5)
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 52 practice questions to prepare you well beyond it. (estimate)
52questions here
11free pages
6concepts
34%of the exam
Questions 21–25
- 21
A developer is creating a `Logger` class with a method `log` that should write a message to a file. The method needs to access the `file_path` attribute of the instance. Which method definition correctly declares the method and accesses the attribute?
Select an answer first - 22
A `Car` class has a method `drive` that takes a distance and updates the `odometer` attribute. A user creates two instances `car1` and `car2`. They call `car1.drive(100)`. Which statement is true about the `odometer` attribute?
Select an answer first - 23
A `User` class has a method `change_password` that must validate the new password using a `validate_password` method, and if valid, update the `password` attribute. Which implementation correctly uses `self` to call the validation method and update the attribute?
Select an answer first - 24
In a `ShoppingCart` class, the `add_item` method needs to update the total price and also log the addition. The `log` method is defined in the same class. How should `add_item` call `log` to ensure it uses the current instance's data?
Select an answer first - 25
A developer is explaining to a team why a method defined in a class must always have `self` as its first parameter. Which reason is most accurate?
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.