Skip to main contentSkip to solution

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

✅ Correct Option: 4

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.

Keyboard Shortcuts

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