Skip to main contentSkip to solution

When an exception is raised, ___________ type of built-in-exception occurs.

(A) SyntaxError

(B) ValueError

(C) KeyBoardInterruptError

(D) NameError

Solution

✅ Correct Option: 3

SyntaxError, ValueError, KeyboardInterrupt and NameError are all built-in exception types in Python, and each is raised in a different situation.

ExceptionRaised when
SyntaxErrorthe code breaks Python's grammar rules, e.g. a missing colon
ValueErrora function gets the right type of argument but an unsuitable value, e.g. int("abc")
KeyboardInterruptthe user interrupts the program, e.g. by pressing Ctrl+C
NameErrora variable or function name is used before it is defined

The question intends (C) to mean KeyboardInterrupt, so all four statements count and Option 3 follows.


We believe the answer could be Option 2, since Python has no built-in exception named "KeyBoardInterruptError" (the real name is KeyboardInterrupt), so (C) is strictly not valid. However, NTA's final answer key (after all challenges) says Option 3.

Keyboard Shortcuts

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