Courseiva
Exception Handling and Development ToolsmediumMultiple SelectObjective-mapped

1Z0-811 Exception Handling and Development Tools Practice Question

Which TWO statements about the finally block are true? (Choose two.)

⚠ Common exam trap

It's easy for candidates to think the finally block only runs when an exception occurs (Option B) or that it cannot contain a return statement (Option D), but the exam tests the precise behavior that finally always executes and can contain return statements, albeit with side effects.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

A try block must be followed by either a catch or finally.

A try block must be followed by at least one catch block or a finally block in Java. Option C is correct because the finally block is intended for resource cleanup code that always executes, regardless of whether an exception occurs. Options B, D, and E are false: B because finally always executes unless the JVM exits; D because finally can contain a return statement (though not recommended); E because finally executes after the catch block only when a catch block is invoked—if no exception occurs, there is no catch block, so the statement is not universally true.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • A try block must be followed by either a catch or finally.

    Why this is correct

    Correct. A try block must have either a catch or a finally block.

  • The finally block executes only if an exception is thrown.

    Why it's wrong here

    Incorrect. The finally block always executes (unless the JVM exits), not only when an exception is thrown.

  • The finally block is used for resource cleanup.

    Why this is correct

    Correct. The finally block is designed for resource cleanup that must run.

  • The finally block cannot contain a return statement.

    Why it's wrong here

    Incorrect. The finally block can contain a return statement, though it may suppress exceptions.

  • The finally block is executed after the catch block.

    Why it's wrong here

    Incorrect. The finally block executes after the catch block only if a catch block is present and invoked. If no exception occurs, there is no catch block.

About these practice questions

This 1Z0-811 question is part of Courseiva's 481-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.