1Z0-829 Controlling Program Flow Practice Question
Exhibit
Refer to the exhibit.
```
int[] numbers = {1, 2, 3, 4, 5};
int sum = 0;
for (int i = 0; i < numbers.length; i++) {
if (numbers[i] % 2 == 0) {
continue;
}
sum += numbers[i];
}
System.out.println(sum);
```What is the output?
```java
int x = 10;
do { System.out.print(x);
} while (x-- > 10);
```
⚠ Common exam trap
The trap here is that candidates often forget that the post-decrement operator uses the original value in the condition before decrementing, leading them to think the first printed value is 10 instead of 9.
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
✓
10
10 because in the missing code, the loop condition likely uses pre-decrement or the print statement occurs before the decrement, so the first value printed is the initial value of x, which is 10. The post-decrement trap described in the current explanation does not apply.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
9
Why it's wrong here
This is incorrect because if the print occurs before decrement, the first output is 10, not 9.
- ✗
15
Why it's wrong here
This value is not produced by any typical loop with x starting at 10.
- ✓
10
Why this is correct
This is correct because the missing code outputs 10 as the first and only value.
- ✗
6
Why it's wrong here
This value does not match the expected output from the described code.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-829 question from scratch — 513 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-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.