PCAP Object-Oriented Programming Practice Question
This PCAP practice question tests your understanding of object-oriented programming. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
$ cat abstract_example.py
from abc import ABC, abstractmethod
class Shape(ABC):
@abstractmethod
def area(self):
pass
class Circle(Shape):
def __init__(self, radius):
self.radius = radius
$ python3 -c "from abstract_example import Circle; c = Circle(5)"
Refer to the exhibit. What happens when the last command is executed?
Exhibit
$ cat abstract_example.py
from abc import ABC, abstractmethod
class Shape(ABC):
@abstractmethod
def area(self):
pass
class Circle(Shape):
def __init__(self, radius):
self.radius = radius
$ python3 -c "from abstract_example import Circle; c = Circle(5)"
A
It creates a Circle object successfully
Why wrong: Incorrect: Circle is still abstract.
B
It prints nothing and exits with code 0
Why wrong: Incorrect: instantiation fails.
C
It raises TypeError: Can't instantiate abstract class Circle with abstract methods area
Correct: abstract method not implemented.
D
It raises AttributeError: 'Circle' object has no attribute 'area'
Why wrong: Incorrect: error occurs at instantiation, not attribute access.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
It raises TypeError: Can't instantiate abstract class Circle with abstract methods area
Option C is correct because the last command attempts to instantiate an abstract class `Circle` that has an abstract method `area` which has not been implemented. In Python, abstract classes defined with `ABC` and decorated with `@abstractmethod` cannot be instantiated directly; attempting to do so raises `TypeError` with the message 'Can't instantiate abstract class Circle with abstract methods area'.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
It creates a Circle object successfully
Why it's wrong here
Incorrect: Circle is still abstract.
✗
It prints nothing and exits with code 0
Why it's wrong here
Incorrect: instantiation fails.
✓
It raises TypeError: Can't instantiate abstract class Circle with abstract methods area
Why this is correct
Correct: abstract method not implemented.
Related concept
Read the scenario before looking for a memorised answer.
✗
It raises AttributeError: 'Circle' object has no attribute 'area'
Why it's wrong here
Incorrect: error occurs at instantiation, not attribute access.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The Python Institute's PCAP exam often tests the distinction between `TypeError` for abstract class instantiation and `AttributeError` for missing attributes on an existing object, trapping candidates who confuse the timing of the error (instantiation vs. method call).
Detailed technical explanation
How to think about this question
Under the hood, Python's `abc` module uses a metaclass `ABCMeta` that overrides `__new__` to check for unimplemented abstract methods during instantiation. This ensures that abstract classes enforce a contract for subclasses; any concrete subclass must override all abstract methods or it remains abstract. In real-world scenarios, this pattern is crucial for designing frameworks where base classes define interfaces that must be implemented by derived classes, preventing runtime errors from missing method definitions.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A media company stores terabytes of video archives that are accessed once a year for audit purposes. Moving these objects to a cold storage tier (Azure Archive, S3 Glacier, or Google Nearline) costs a fraction of hot storage. Questions like this test whether you understand storage tiers, access frequency tradeoffs, and retrieval latency requirements.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Object-Oriented Programming — This question tests Object-Oriented Programming — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: It raises TypeError: Can't instantiate abstract class Circle with abstract methods area — Option C is correct because the last command attempts to instantiate an abstract class `Circle` that has an abstract method `area` which has not been implemented. In Python, abstract classes defined with `ABC` and decorated with `@abstractmethod` cannot be instantiated directly; attempting to do so raises `TypeError` with the message 'Can't instantiate abstract class Circle with abstract methods area'.
What should I do if I get this PCAP question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This PCAP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCAP exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.