Chapter 9 Quiz
Error Handling — 3 questions.
Chapter 9 Quiz
Error Handling — 3 questions.
1 mark
[{"question":"Which exception is raised when trying to access a list index that doesn't exist?","options":["ValueError","KeyError","IndexError","TypeError"],"correct":2},{"question":"In a try/except/else/finally block, when does the else block run?","options":["Always, regardless of exceptions","Only if no exception occurs","Only if an exception occurs","After the finally block"],"correct":1},{"question":"How do you create a custom exception in Python?","options":["Define a function","Create a class that inherits from Exception","Use the raise keyword with a string","Use the error keyword"],"correct":1}]
error-handling