Courseiva

PCEP Practice Question: Functions, Tuples, Dictionaries and Exceptions

Which TWO of the following exceptions are built-in Python exceptions? (Select exactly 2)

⚠ Common exam trap

Python Institute often tests the distinction between built-in exceptions and non-existent exceptions like StringError, NumberError, or ListError, which are not part of Python's standard library, to catch candidates who guess based on naming patterns rather than actual Python knowledge.

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

ZeroDivisionError is a built-in Python exception that is raised when the second operand of a division or modulo operation is zero. It is part of Python's standard exception hierarchy and is commonly encountered in arithmetic operations.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    ZeroDivisionError

    Why this is correct

    Built-in exception for division by zero.

  • ✓

    KeyError

    Why this is correct

    Built-in exception for missing dictionary keys.

  • ✗

    StringError

    Why it's wrong here

    Not a standard Python exception.

  • ✗

    NumberError

    Why it's wrong here

    Not a standard Python exception.

  • ✗

    ListError

    Why it's wrong here

    Not a standard Python exception.

About these practice questions

One of 482 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on PCEP

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. Refer to the exhibit. What type of exception occurred?

easy
  • ✓ A.ZeroDivisionError
  • B.TypeError
  • C.ValueError
  • D.ArithmeticError

Why A: The code attempts to divide by zero (e.g., `10 / 0`), which raises a `ZeroDivisionError` in Python. This is a specific built-in exception for division or modulo operations where the divisor is zero.

Variation 2. Refer to the exhibit. What exception is raised when this code is executed?

easy
  • A.ValueError
  • ✓ B.ZeroDivisionError
  • C.ArithmeticError
  • D.TypeError

Why B: 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.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.