Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Exceptions Quiz

Total questions: 1

Worksheet time: 7mins

Name
Class
Date
1-9.
1.

What is raised when an assert statement fails in Python?

a)

AttributeError

b)

AssertionError

c)

MemoryError

d)

ReferenceError

2.

Which exception is the base class for all exceptions in Python?

a)

Exception

b)

RuntimeError

c)

IOError

d)

BaseError

3.

What exception is raised when a program runs out of memory?

a)

MemoryError

b)

OverflowError

c)

BufferError

d)

RuntimeError

4.

Which exception is raised due to a system-related error in Python?

a)

SystemError

b)

OSError

c)

EnvironmentError

d)

RuntimeError

5.

What is raised when the result of a numeric calculation is too large in Python?

a)

ArithmeticError

b)

MemoryError

c)

OverflowError

d)

FloatingPointError

6.

What error is raised when the next() method of an iterator has no further values?

a)

RuntimeError

b)

StopIteration

c)

SyntaxError

d)

ValueError

7.

Which error occurs due to a syntax problem?

a)

SystemError

b)

TypeError

c)

SyntaxError

d)

UnboundLocalError

8.

When is a TypeError raised?

a)

When there is a wrong value in a specified data type

b)

When the sys.exit() function is called

c)

When two different types are combined

d)

When an error occurs that do not belong to any specific exceptions

9.

What causes a ZeroDivisionError?

a)

When a unicode problem occurs

b)

When a local variable is referenced before assignment

c)

When the second operator in a division is zero

d)

When indentation consists of tabs or spaces