Skip to main contentSkip to solution

The statements inside the _____ block are always executed regardless of whether an exception has occurred or not.

Solution

✅ Correct Option: 3

The finally block runs every time, whether the try block raised an exception, ran cleanly, or was left through return, break or continue. It is used for clean-up work such as closing files or releasing connections.


Option 1: try holds the code that may raise an exception, and it stops at the point where the exception occurs.

Option 2: except runs only when a matching exception is raised.

Option 4: else runs only when the try block finishes with no exception, the opposite condition to except.

Keyboard Shortcuts

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