Skip to main contentSkip to solution

Which of the following are built-in exceptions in Python?

A. EOFError

B. IndentationError

C. TypeError

D. RaiseError

Solution

✅ Correct Option: 2

EOFError, IndentationError and TypeError are all built-in exception classes in Python.

EOFError is raised when input() hits the end of the file without reading any data. IndentationError is raised when the code has incorrect indentation. TypeError is raised when an operation is applied to an object of the wrong type, such as "a" + 1.


D (RaiseError): no such exception exists. raise is a keyword used to throw an exception, and it is often confused with an exception name.

Options 1, 3 and 4 are wrong because each of them includes D.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question