Class - 12 CBSE Computer Science — Assertion Reason Type Questions
Assertion (A): Exception handling code is clear and block based in Python.
Reasoning (R): The code where unexpected runtime exception may occur is separate from the code where the action takes place when an exception occurs.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Python Exception Handling
1 Like
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
In Python, the structure of exception handling using clear and distinct blocks like try, except, and finally helps in organizing code. It separates the code where exceptions might occur (within the try block) from the code responsible for handling those exceptions (within the except and finally blocks).
Answered By
2 Likes