Search Header Logo

Python Error Handling

11th Grade

CCSS covered

Used 238+ times

Python Error Handling
AI

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:

a logic error
a run-time error
a logic error
a user error

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

A syntax error in your code means:

You have not used enough characters. 
There was no defined index. 
Python can't find a file to pass the code to. 
There is an error with your typing and code structure. 

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will the output be from the following code?
print(Hello world!)

Hello world!
SyntaxError
Hello world
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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?