When an exception is raised, ___________ type of built-in-exception occurs.
(A) SyntaxError
(B) ValueError
(C) KeyBoardInterruptError
(D) NameError
When an exception is raised, ___________ type of built-in-exception occurs.
(A) SyntaxError
(B) ValueError
(C) KeyBoardInterruptError
(D) NameError
Solution
SyntaxError, ValueError, KeyboardInterrupt and NameError are all built-in exception types in Python, and each is raised in a different situation.
| Exception | Raised when |
|---|---|
| SyntaxError | the code breaks Python's grammar rules, e.g. a missing colon |
| ValueError | a function gets the right type of argument but an unsuitable value, e.g. int("abc") |
| KeyboardInterrupt | the user interrupts the program, e.g. by pressing Ctrl+C |
| NameError | a 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.
Related questions:
2026: 29 May Shift 1
2025: 15 May Shift 2
2026: 24 May Shift 1