1Z0-811 Control Flow and Loops Practice Question
Exhibit
int count = 0;
for (int i = 0; i < 3; i++) {
count++;
if (i == 1) continue;
count++;
}
System.out.println(count);Refer to the exhibit. What is the output?
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
✓
5
The loop iterates i=0,1,2. For i=0: count becomes 1, then 2. For i=1: count becomes 3, continue skips second increment, so count stays 3. For i=2: count becomes 4, then 5. Output is 5.
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 calculation.
- ✗
6
Why it's wrong here
Incorrect; would be 6 if continue didn't skip the increment.
- ✗
4
Why it's wrong here
Incorrect; the continue at i=1 prevents one increment, but not enough to result in 4.
- ✓
5
Why this is correct
The output '5' arises from correctly evaluating the `length` property of the array presented in the exhibit. Java arrays provide a public `length` field, not a method, which precisely indicates the total number of elements they can hold. This scenario tests the fundamental understanding of array instantiation and how to determine its size, satisfying the constraint of correctly accessing array properties.
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.