Question 435 of 513
1Z0-829 Controlling Program Flow Practice Question
Given the following code snippet:
```java outer:
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (i == 1 && j == 1) {break outer;
}
System.out.print(i + "-" + j + " ");
} }
```
What is the output?
⚠ Common exam trap
The trap here is that candidates often forget that a labeled break exits the outer loop entirely, not just the inner loop, leading them to choose option A or D which include `1-1` or later iterations.
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
✓
0-0 0-1 0-2 1-0
The labeled `break outer;` statement exits the outer loop entirely when `i == 1` and `j == 1`. Before that condition is met, the inner loop prints pairs for `i=0` (all j values 0,1,2) and for `i=1` with `j=0`. When `i=1` and `j=1`, the break occurs, so `1-1` is never printed, and the outer loop stops, preventing any further iterations.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
0-0 0-1 0-2 1-0 1-1 1-2
Why it's wrong here
The outer loop is broken, so inner loop stops entirely.
- ✓
0-0 0-1 0-2 1-0
Why this is correct
Correct. The loop prints all combinations until the break condition at (1,1).
- ✗
0-0 0-1 0-2 1-0 2-0 2-1 2-2
Why it's wrong here
The break exits outer loop, so i never reaches 2.
- ✗
0-0 0-1 0-2 1-0 1-1
Why it's wrong here
The break occurs before printing (1,1).
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 25, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.