1Z0-811 Primitives, Strings and Operators Practice Question
Exhibit
int x = 5; int y = 0; int z = x / y; System.out.println(z);
Refer to the exhibit. What is the result?
⚠ Common exam trap
Oracle often tests the difference between integer and floating-point division by zero, trapping candidates who assume all division by zero yields Infinity or a compile error, when in fact integer division throws a runtime 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
✓
Runtime exception
The code attempts to divide an integer by zero, which in Java throws an ArithmeticException at runtime. Since the division is performed with integer operands (int / int), Java does not allow division by zero and raises an exception, not a floating-point infinity or zero. Therefore, the correct answer is C: Runtime exception.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Compilation error
Why it's wrong here
Code compiles; division by zero is runtime error.
- ✗
0
Why it's wrong here
No value is returned; exception is thrown.
- ✓
Runtime exception
Why this is correct
The exhibit's code attempts an integer division where the divisor evaluates to zero during execution. Java's runtime environment detects this illegal operation, leading to an `ArithmeticException`. This specific exception is a subclass of `RuntimeException`, which is unchecked and typically indicates a programming error that occurs after compilation, preventing the program from continuing its normal flow.
- ✗
Infinity
Why it's wrong here
Infinity occurs only for floating-point division.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-811 question from scratch — 481 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.