1Z0-811 Primitives, Strings and Operators Practice Question
Exhibit
Refer to the exhibit.
public class Test {
public static void main(String[] args) {
int x = 10;
int y = x++ + ++x;
System.out.println(y);
}
}What is the value of y after executing the following code? ```java
int y = 10 + 12;
```
⚠ Common exam trap
Oracle often tests the candidate's attention to basic arithmetic with integer literals, where a simple misreading of the operands or operator leads to selecting a plausible but incorrect sum.
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
✓
22
The code snippet `int y = 10 + 12;` performs integer addition, resulting in y = 22. Java's primitive arithmetic follows standard rules, so adding 10 and 12 yields 22 without any overflow or conversion issues.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
22
Why this is correct
The value of y is 22 because Java's operator precedence rules dictate that multiplication operations are evaluated before addition. For an expression like `10 + 3 * 4`, the `3 * 4` calculation is performed first, yielding 12. Subsequently, 10 is added to this intermediate result, satisfying the requirement for the final value of y to be 22 by correctly applying the order of operations.
- ✗
20
Why it's wrong here
Incorrect.
- ✗
21
Why it's wrong here
Incorrect.
- ✗
23
Why it's wrong here
Incorrect.
Go deeper
Related to this question
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 →
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.