
Python InstitutePCAP - Certified Associate Python Programmer
Domain 4Objective 5
PCAP-31-03 4.5 Build a Class Hierarchy Using Inheritance PCAP-31 Practice Questions (Page 3)
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 24 practice questions to prepare you well beyond it. (estimate)
24questions here
5free pages
8concepts
34%of the exam
Questions 11–15
- 11
Given the following code: x = None y = None Which of the following expressions evaluates to True?
Select an answer first - 12
Given the following code: class Rectangle: def __init__(self, w, h): self.w = w self.h = h def area(self): return self.w * self.h class Circle: def __init__(self, r): self.r = r def area(self): return 3.14 * self.r ** 2 def print_area(shape): print(shape.area()) print_area(Rectangle(2, 3)) print_area(Circle(1)) What is the output?
Select an answer first - 13
A developer defines a base class `Vehicle` with a `move()` method that prints "Vehicle moving". They then define `class Car(Vehicle)` and override `move()` to print "Car driving". Later, they create `c = Car()` and call `c.move()`. What is the output?
Select an answer first - 14
Consider the following class hierarchy: class A: def method(self): return "A" class B(A): pass class C(A): pass class D(B, C): pass What is the method resolution order (MRO) for class D?
Select an answer first - 15
Consider the following code: a = [1, 2, 3] b = [1, 2, 3] Which of the following expressions evaluates to True?
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.