Computer Science

Assertion (A): Exception handling code is separate from normal code.

Reasoning (R): Program logic is different while exception handling code uses specific keywords to handle exceptions.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. 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
Exception handling code is separate from normal code in programming languages. Exception handling code uses specific constructs like try, except, finally (in Python). Exception handling involves a different flow of control compared to regular program logic. When an exception occurs, the program jumps to the corresponding exception handling block (such as the except block in Python) rather than following the normal sequence of statements.

Answered By

2 Likes


Related Questions