Python Built-in Exceptions Flashcards

1
Q

ArithmeticError

A

Raised when an error occurs in numeric calculations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

AssertionError

A

Raised when an assert statement fails

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

AttributeError

A

Raised when attribute reference or assignment fails

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Exception

A

Base class for all exceptions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

EOFError

A

Raised when the input() method hits an “end of file” condition (EOF)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

FloatingPointError

A

Raised when a floating point calculation fails

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

GeneratorExit

A

Raised when a generator is closed (with the close() method)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

ImportError

A

Raised when an imported module does not exist

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

IndentationError

A

Raised when indentation is not correct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

IndexError

A

Raised when an index of a sequence does not exist

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

KeyError

A

Raised when a key does not exist in a dictionary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

KeyboardInterrupt

A

Raised when the user presses Ctrl+c, Ctrl+z or Delete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

LookupError

A

Raised when errors raised cant be found

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

MemoryError

A

Raised when a program runs out of memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

NameError

A

Raised when a variable does not exist

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

NotImplementedError

A

Raised when an abstract method requires an inherited class to override the method

17
Q

OSError

A

Raised when a system related operation causes an error

18
Q

OverflowError

A

Raised when the result of a numeric calculation is too large

19
Q

ReferenceError

A

Raised when a weak reference object does not exist

20
Q

RuntimeError

A

Raised when an error occurs that do not belong to any specific exceptions

21
Q

StopIteration

A

Raised when the next() method of an iterator has no further values

22
Q

SyntaxError

A

Raised when a syntax error occurs

23
Q

TabError

A

Raised when indentation consists of tabs or spaces

24
Q

SystemError

A

Raised when a system error occurs

25
SystemExit
Raised when the sys.exit() function is called
26
TypeError
Raised when two different types are combined
27
UnboundLocalError
Raised when a local variable is referenced before assignment
28
UnicodeError
Raised when a unicode problem occurs
29
UnicodeEncodeError
Raised when a unicode encoding problem occurs
30
UnicodeDecodeError
Raised when a unicode decoding problem occurs
31
UnicodeTranslateError
Raised when a unicode translation problem occurs
32
ValueError
Raised when there is a wrong value in a specified data type
33
ZeroDivisionError
Raised when the second operator in a division is zero