Question 247 of 498
PCEP Practice Question: Functions, Tuples, Dictionaries and Exceptions
Exhibit
Refer to the exhibit.
Error log output:
Traceback (most recent call last):
File "app.py", line 10, in <module>
result = divide(10, 0)
File "app.py", line 5, in divide
return a / b
ZeroDivisionError: division by zeroBased on the exhibit, where did the exception originate?
⚠ Common exam trap
The PCEP exam often tests the misconception that an exception originates at the line where the function is called (the call site) rather than inside the function where the actual erroneous operation occurs, leading candidates to pick the call site line instead of the function's internal line.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
At line 5 in the divide function inside app.py.
The exception (ZeroDivisionError) originates at line 5 inside the divide function in app.py, where the code attempts to divide by zero. The traceback shows the innermost frame first, indicating the exact line where the error was raised.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
At line 5 in the divide function inside app.py.
Why this is correct
The traceback shows the exception was raised at line 5, inside the divide function.
- ✗
In the main module outside any function.
Why it's wrong here
The error is inside the divide function, not at module level.
- ✗
In the ZeroDivisionError exception handler.
Why it's wrong here
There is no exception handler; it's an unhandled exception.
- ✗
At line 10 in app.py, where the function was called.
Why it's wrong here
Line 10 is the call site, but the exception was raised inside the function.
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 →
Last reviewed: Jul 4, 2026
This PCEP 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 PCEP 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.