1Z0-811 Exception Handling and Development Tools Practice Question
Exhibit
Exception in thread "main" java.lang.ArithmeticException: / by zero at com.example.Calculator.divide(Calculator.java:12) at com.example.Main.main(Main.java:5)
Refer to the exhibit. A developer encounters this exception when running the application. The method divide is intended to handle division by zero. What is the most likely cause of the exception?
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
✓
The divide method uses integer division without checking the divisor.
The exception is ArithmeticException, which occurs when integer division by zero is performed. The stack trace points to line 12 inside the divide method, indicating that the method did not check whether the divisor is zero before performing the division. Option C is correct because using integer division without checking the divisor is the direct cause. Option A is incorrect because ArithmeticException is an unchecked exception, so catching it is not mandatory. Option B is incorrect because the JVM correctly throws the exception; it is not a configuration issue. Option D is incorrect because unchecked exceptions do not need to be declared in a throws clause.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The divide method does not catch ArithmeticException.
Why it's wrong here
Catching is not required; unchecked exceptions can be allowed to propagate. Not catching does not cause the exception—it is caused by the division operation.
- ✗
The JVM is not configured to handle arithmetic exceptions.
Why it's wrong here
The JVM correctly throws the exception; no special configuration is needed.
- ✓
The divide method uses integer division without checking the divisor.
Why this is correct
Integer division by zero throws ArithmeticException. The method should check if the divisor is zero before performing division.
- ✗
The Main class does not declare throws ArithmeticException.
Why it's wrong here
Unchecked exceptions like ArithmeticException are not required to be declared in a throws clause.
Go deeper
Related to this question
About these practice questions
One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
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.