1Z0-829 Controlling Program Flow Practice Question
Which two statements about the do-while loop are true?
⚠ Common exam trap
Candidates often confuse the evaluation order of do-while (post-test) with while (pre-test), leading them to incorrectly select option A, and they may overlook that labels are valid for all loop constructs in Java, not just for or while loops.
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
✓
The do-while loop can be used with a label.
Java allows any loop, including the do-while loop, to be labeled. A label is a valid Java identifier followed by a colon placed immediately before the loop statement, enabling break or continue to transfer control to that labeled point. This is explicitly permitted by the Java Language Specification for all iteration statements.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The condition is evaluated before the body executes.
Why it's wrong here
Incorrect; that's a while loop, not do-while.
- ✗
The do-while loop cannot have an initialization statement.
Why it's wrong here
Incorrect; initialization can be done outside the loop.
- ✓
The do-while loop can be used with a label.
Why this is correct
Correct: labels are allowed on any loop statement.
- ✓
The body of a do-while loop executes at least once.
Why this is correct
Correct: the condition is checked after the body.
- ✗
The do-while loop always executes more times than a while loop with the same condition.
Why it's wrong here
Incorrect; both depend on the condition, but do-while always executes at least once.
Go deeper
Related to this question
About these practice questions
This 1Z0-829 question is part of Courseiva's 513-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-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.