What is Exception handling primarily used for?
- A. A technique where a function calls itself to solve smaller instances of a problem.
- B. A programming mechanism used to detect and respond to runtime errors gracefully. ✓
- C. The region of a program where a declared variable can be accessed.
- D. A classification that specifies what kind of value a variable can hold, such as integer or string.
Correct answer
B. A programming mechanism used to detect and respond to runtime errors gracefully.
Explanation
Exception handling refers to a programming mechanism used to detect and respond to runtime errors gracefully.