This 1Z0-829 practice question tests your understanding of handling exceptions. Examine the command output carefully: the correct answer depends on what the output actually shows, not on general recall alone. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
Refer to the exhibit.
public class Main {
public static void main(String[] args) {
try {
int result = 10 / 0;
} catch (ArithmeticException e) {
System.out.println("Arithmetic");
throw e;
} catch (Exception e) {
System.out.println("Exception");
} finally {
System.out.println("Finally");
}
}
}
What is the output when the code is executed?
Exhibit
Refer to the exhibit.
public class Main {
public static void main(String[] args) {
try {
int result = 10 / 0;
} catch (ArithmeticException e) {
System.out.println("Arithmetic");
throw e;
} catch (Exception e) {
System.out.println("Exception");
} finally {
System.out.println("Finally");
}
}
}
A
Arithmetic
Finally
Why wrong: Incorrect: This would be the output if the exception were not rethrown after the catch block.
B
Arithmetic
Exception
Finally
Why wrong: Incorrect: The second catch block is not reached because the exception is rethrown from the first catch.
C
Exception
Finally
Why wrong: Incorrect: The ArithmeticException is caught first, so 'Arithmetic' is printed, not 'Exception'.
D
Arithmetic
Finally
[stack trace]
Correct: 'Arithmetic' is printed, then finally prints 'Finally', then the rethrown exception causes a stack trace.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Arithmetic
Finally
[stack trace]
Option D is correct because the code throws an ArithmeticException (division by zero) inside the try block, which is caught by the first catch block (ArithmeticException). The finally block always executes after the catch block, printing 'Finally'. The stack trace is printed because the exception is re-thrown in the catch block (implicitly or explicitly) and not handled, causing the program to terminate with an uncaught exception. The output shows 'Arithmetic', then 'Finally', followed by the stack trace.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
Arithmetic
Finally
Why it's wrong here
Incorrect: This would be the output if the exception were not rethrown after the catch block.
✗
Arithmetic
Exception
Finally
Why it's wrong here
Incorrect: The second catch block is not reached because the exception is rethrown from the first catch.
✗
Exception
Finally
Why it's wrong here
Incorrect: The ArithmeticException is caught first, so 'Arithmetic' is printed, not 'Exception'.
✓
Arithmetic
Finally
[stack trace]
Why this is correct
Correct: 'Arithmetic' is printed, then finally prints 'Finally', then the rethrown exception causes a stack trace.
Related concept
Read the scenario before looking for a memorised answer.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates forget that a re-thrown exception produces a stack trace, or they mistakenly think the generic Exception catch block will execute after the specific one, leading them to choose Option B or C.
Trap categories for this question
Command / output trap
Incorrect: This would be the output if the exception were not rethrown after the catch block.
Detailed technical explanation
How to think about this question
In Java, when an exception is caught and then re-thrown (either explicitly with 'throw' or implicitly by not handling it), the stack trace is preserved and printed by the default uncaught exception handler. The finally block executes after the catch block, regardless of whether the exception is re-thrown, ensuring cleanup code runs. This behavior is defined in JLS §14.20.2, and the order of catch blocks matters: the first matching catch block (most specific) is executed.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A practitioner preparing for the 1Z0-829 exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Handling Exceptions — This question tests Handling Exceptions — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Arithmetic
Finally
[stack trace] — Option D is correct because the code throws an ArithmeticException (division by zero) inside the try block, which is caught by the first catch block (ArithmeticException). The finally block always executes after the catch block, printing 'Finally'. The stack trace is printed because the exception is re-thrown in the catch block (implicitly or explicitly) and not handled, causing the program to terminate with an uncaught exception. The output shows 'Arithmetic', then 'Finally', followed by the stack trace.
What should I do if I get this 1Z0-829 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This 1Z0-829 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-829 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.