Exception Handling Flashcards
6 cards from real PCAP practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 Exception Handling flashcards as text
Which keyword is used to handle exceptions in Python?
Answer: except
The `except` clause in a `try` block is used to catch and handle exceptions.
What happens if no exception is raised in a `try` block that has an `else` clause?
Answer: The else block is executed
The `else` block runs only when no exception is raised in the `try` block.
Which block always executes regardless of whether an exception occurred?
Answer: finally
The `finally` block always runs whether or not an exception was raised, used for cleanup.
How do you raise a custom exception in Python?
Answer: raise Exception('msg')
Python uses the `raise` keyword to manually throw an exception.
What is the base class for all built-in exceptions in Python?
Answer: BaseException
`BaseException` is the root of the Python exception hierarchy; `Exception` is its subclass for non-system-exiting exceptions.
What does `except Exception as e:` allow you to do?
Answer: Access the exception object via the variable `e`
The `as e` clause binds the caught exception object to the name `e` for inspection.
How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- pythoninstitute.org — Eligibility, fees, exam format, passing score, retake fee, retake policy, score release, time limit, score validity, exam information · verified Oct 2026
- home.pearsonvue.com — Test delivery · verified Oct 2026