12 Unit Test 2 - Exception Handling
12 Unit Test 2 - Exception Handling
Section A
1.“Every syntax error is an exception but every exception cannot be a syntax error.”
Justify the statement.
2.When are the following built-in exceptions raised? Give examples to support your
answers.
ImportError
IOError
NameError
d) ZeroDivisionError
3. What is the use of a raise statement?
4. Define the following: a) Exception Handling b) Throwing an exception c) Catching
an exception
5. Explain catching exceptions using try and except block.
6. Explain Finally clause?
7. Write any program for Exception handling?
Section B
1.Assertion (A): Exception handling in Python allows for graceful recovery from
errors and prevents program crashes.
Reason (R): When an error occurs during program execution, Python's exception
handling mechanism allows the program to gracefully handle the error and take
corrective action.