Skills101
← All practice quizzes

Quiz: Exceptions in Depth

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Go beyond basic try/except. Learn the exception class tree, the exact order of try, except, else and finally, how to write your own exception classes, re-raise and chain errors, and when to use assert.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    Which exception does except LookupError: catch?

  2. Question 2

    When does the else part of a try statement run?

  3. Question 3

    What does this print?

    def f():
        try:
            return "try"
        finally:
            print("finally", end=" ")
    print(f())
    
  4. Question 4

    What does this print?

    try:
        int("x")
    except Exception:
        print("general")
    except ValueError:
        print("value")
    
  5. Question 5

    What should a custom exception class usually inherit from?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →