Bird
0
0

In a try-except-finally block, if no exception occurs, which blocks are executed?

easy📝 Conceptual Q2 of 15
Python - Advanced Exception Handling
In a try-except-finally block, if no exception occurs, which blocks are executed?
ATry and finally blocks.
BOnly the try block.
CTry and except blocks.
DTry, except, and finally blocks.
Step-by-Step Solution
Solution:
  1. Step 1: Check normal execution flow

    If no exception occurs, the except block is skipped.
  2. Step 2: Confirm finally block behavior

    The finally block always runs regardless of exceptions.
  3. Final Answer:

    Try and finally blocks. -> Option A
  4. Quick Check:

    No exception means except skipped, finally runs [OK]
Quick Trick: finally runs always; except runs only on exception [OK]
Common Mistakes:
  • Thinking except runs even without exception
  • Believing finally block runs only on exception
  • Assuming only try block runs if no error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes