
Python Error Handling
11th Grade
CCSS covered
Used 238+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
A program runs and, during running, is asked to divide by zero. The program crashes. This is an example of:
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
A syntax error in your code means:
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will the output be from the following code?
print(Hello world!)
Tags
CCSS.L.2.2C
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Improper indentation is an example of what type of error?
Syntax Error
Run-time Error
Semantic Error
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
To control for possible bad inputs, what keyword do I need:
def convI(s):
try:
num = int(s)
print('Success')
_______ ValueError:
print('Failed')
num = -1
raise
else
Exception
except
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In the following code, I want to throw an exception if the denominator is not negative. What should I put after starting my function>
def div(n,d):
if d == negative:
try ('No negatives, moron')
if d == negative:
raise ('No negatives, moron')
if d<0:
raise Exception('I said no negative numbers, dimwit')
if d<0:
try Exception('I said no negative numbers, dimwit')
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which keyword should we use to printout only under the case of a successful running of a function?
try
raise
finally
else
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?