curriculum/challenges/english/blocks/quiz-error-handling/67f412eaf6e68343aab8ea81.md
To pass the quiz, you must correctly answer at least 9 of the 10 questions below.
What will be the output of this code?
try:
print(22 / 0)
except ZeroDivisionError:
print("You can't divide by zero!")
22
10
0
You can't divide by zero!
Which module of the Python standard library lets you debug your code in an interactive way?
ABC
numpy
debugpy
pdb
Which exception does Python raise when you try to use a method or attribute that does not exist for that type?
SyntaxError
AttributeBug
SyntaxBug
AttributeError
Which Python statement can you insert around various points in your code so you can see the values of variables while debugging?
len()
console()
log()
print()
Which statement lets you manually raise an exception?
if
throw
from
raise
Which error will the code print("Hello world" raise in your Python code?
It would not raise any error.
ValueError
NameError
SyntaxError
What does try...except let you do in Python?
It provides a way to test your code interactively.
It lets you write mathematical expressions.
It speeds up testing.
It lets you execute a block of code that might raise an exception.
Which object lets you access the exception itself for better debugging and direct printing of the error message?
Debugger Object
Traceback Object
BugFinder Object
Exception Object
Which of the following optional clauses can be added to a try...except statement?
if and else
elif and if
else and elif
else and finally
Which block of a try statement runs whether an error occurs or not?
else
except
try
finally