Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What does the finally block guarantee?

  1. A It runs only when no exception occurs
  2. B It always runs, whether or not an exception was thrown
  3. C It suppresses the exception
  4. D It runs before the try block
Answer

It always runs, whether or not an exception was thrown

finally is used for cleanup such as releasing a lock or closing a resource, and executes even if try or catch returns.

All Php MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as