Question 308 of 498
PCEP Practice Question: Functions, Tuples, Dictionaries and Exceptions
Exhibit
def divide(a, b):
return a / b
result = divide(10, 0)Refer to the exhibit. What exception is raised when this code is executed?
⚠ Common exam trap
Many candidates choose ArithmeticError because it is a parent class, but Python always raises the more specific ZeroDivisionError, and the exam expects you to know the exact exception name.
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
✓
ZeroDivisionError
The code attempts to divide by zero, which raises a ZeroDivisionError in Python. This is a specific exception for division or modulo operations where the divisor is zero, and it is a subclass of ArithmeticError.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
ValueError
Why it's wrong here
ValueError is for inappropriate argument value, not for division by zero.
- ✓
ZeroDivisionError
Why this is correct
Correct: Division by zero raises ZeroDivisionError.
- ✗
ArithmeticError
Why it's wrong here
ArithmeticError is the base class; the actual exception is ZeroDivisionError.
- ✗
TypeError
Why it's wrong here
TypeError is for operation on inappropriate type, not for division by zero.
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.