Courseiva
Primitives, Strings and OperatorsmediumMultiple ChoiceObjective-mapped

1Z0-811 Primitives, Strings and Operators Practice Question

Given: int i = 1; int j = i++ + ++i; What is the value of j?

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

4

The expression `i++ + ++i` is evaluated as follows: First, `i++` uses the current value of i (1) and then increments i to 2. Then, `++i` increments i from 2 to 3 and uses the new value (3). So, j = 1 + 3 = 4. Option A (3) incorrectly assumes both operations use the same initial value. Option B (5) incorrectly increments both times before using. Option C (2) incorrectly uses post-increment for both.

Answer analysis

Option-by-option breakdown

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

  • 3

    Why it's wrong here

    Incorrect evaluation of postfix and prefix.

  • 5

    Why it's wrong here

    Incorrect addition.

  • 2

    Why it's wrong here

    Missing the effect of both increments.

  • 4

    Why this is correct

    Correct: i++ = 1, i becomes 2; ++i = 3, i becomes 3; sum 4.

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 →

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.