Each and every exception has to be handled by the programmer to avoid the program from crashing abruptly. This is done by writing additional code in a program to give proper messages or instructions to the user on encountering an exception. This process is known as _____________.
Each and every exception has to be handled by the programmer to avoid the program from crashing abruptly. This is done by writing additional code in a program to give proper messages or instructions to the user on encountering an exception. This process is known as _____________.
Solution
Exception handling is the process of writing extra code (using try and except blocks in Python) so that, when an exception occurs, the program shows a proper message or takes a suitable action instead of crashing abruptly.
Option 1: finally is only one clause of a try block that runs whether or not an exception occurs, usually for clean-up. It is a part of exception handling, not the whole process.
Option 2: raise is used to deliberately trigger an exception, not to handle it.
Option 3: assert tests a condition and raises an AssertionError if it is false. It is used for debugging checks.
Related questions:
2026: 18 May Shift 2
2026: 29 May Shift 1
2026: 20 May Shift 1
2025: 15 May Shift 2