Question 320 of 509
Controlling Program FloweasyMultiple SelectObjective-mapped

Quick Answer

The correct answer is that the break statement without a label immediately terminates the innermost enclosing loop or switch, while the continue statement can be used inside any loop, including for, while, and do-while loops. This behavior is defined by the Java Language Specification (JLS §14.15), which states that an unlabeled break transfers control out of the immediately enclosing construct, whereas continue skips the current iteration and proceeds to the next loop condition check. On the Oracle Certified Professional Java SE 17 Developer 1Z0-829 exam, this concept tests your understanding of control flow and loop mechanics, often appearing in questions that present nested loops or switch-case structures to see if you recognize which construct a break or continue affects. A common trap is assuming break works only in loops, forgetting it also exits a switch block, or thinking continue can be used outside a loop. For a quick memory tip: think of break as "bail out" of the innermost block, and continue as "cut the current lap" and keep running the race.

1Z0-829 Controlling Program Flow Practice Question

This 1Z0-829 practice question tests your understanding of controlling program flow. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Which TWO statements about the break and continue statements in Java are correct?

Question 1easymulti select
Full question →

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 break statement without a label always terminates the innermost enclosing loop or switch.

Option A is correct because the break statement without a label, when executed inside a loop or switch, immediately terminates the innermost enclosing loop or switch construct. This is defined by the Java Language Specification (JLS §14.15), which states that an unlabeled break statement transfers control to the immediately enclosing statement of the break target.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

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 break statement without a label always terminates the innermost enclosing loop or switch.

    Why this is correct

    break without a label exits the innermost loop or switch.

    Related concept

    Read the scenario before looking for a memorised answer.

  • The continue statement can be used inside any loop, including for, while, and do-while loops.

    Why this is correct

    continue is valid in all loop types.

    Related concept

    Read the scenario before looking for a memorised answer.

  • The continue statement can be used inside a switch statement to skip the rest of the switch body.

    Why it's wrong here

    continue cannot be used in a switch unless the switch is inside a loop, and it would target the loop, not the switch.

  • The break statement can be used only inside loops and switch statements.

    Why it's wrong here

    break can also be used in labeled blocks, so 'only' is incorrect.

  • The continue statement without a label skips the current iteration and proceeds to the next iteration without reevaluating the loop condition.

    Why it's wrong here

    continue does reevaluate the loop condition in while and do-while loops; in for loops, it executes the increment statement then checks condition.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often confuse the behavior of continue in different loop types (for vs. while) and incorrectly assume it skips condition reevaluation, or they mistakenly think break can only target loops and switches, ignoring its use with labeled blocks.

Detailed technical explanation

How to think about this question

Under the hood, the break and continue statements are implemented as unconditional jumps in the bytecode (using the goto instruction). The continue statement in a for loop increments the loop counter and then checks the loop condition before the next iteration, which is a subtle but critical difference from a while loop where continue jumps directly to the condition check. In real-world scenarios, misusing continue in a for loop can lead to infinite loops if the increment step is bypassed incorrectly.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related 1Z0-829 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free 1Z0-829 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this 1Z0-829 question test?

Controlling Program Flow — This question tests Controlling Program Flow — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: The break statement without a label always terminates the innermost enclosing loop or switch. — Option A is correct because the break statement without a label, when executed inside a loop or switch, immediately terminates the innermost enclosing loop or switch construct. This is defined by the Java Language Specification (JLS §14.15), which states that an unlabeled break statement transfers control to the immediately enclosing statement of the break target.

What should I do if I get this 1Z0-829 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

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 →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

3 more ways this is tested on 1Z0-829

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. Which two statements about the break statement are true?

medium
  • A.break can be used inside an if statement.
  • B.break without a label terminates the innermost loop or switch.
  • C.break can only be used inside a loop.
  • D.break with a label terminates the outermost matching loop or switch.
  • E.break can be used inside a switch statement.

Why B: Option B is correct because the break statement, when used without a label, immediately terminates the innermost enclosing loop (for, while, do-while) or switch statement. This is defined by the Java Language Specification (JLS §14.15), which states that an unlabeled break statement transfers control out of the immediately enclosing statement.

Variation 2. Which two of the following statements are true about the continue statement in a loop?

easy
  • A.continue can be used in a while loop.
  • B.continue cannot be used in a do-while loop.
  • C.continue can be used in a for loop.
  • D.continue can be used in a switch statement.
  • E.continue can be used in a try block without a loop.

Why A: Option A is correct because the continue statement can be used in any loop construct in Java, including while loops. When executed, continue skips the remaining body of the loop for the current iteration and proceeds to the next iteration's condition check.

Variation 3. Which THREE statements are true about loops in Java?

hard
  • A.The break statement can be used to exit a loop prematurely.
  • B.A while loop always executes at least once.
  • C.The continue statement skips the rest of the current iteration.
  • D.A do-while loop may execute zero times if the condition is false.
  • E.A for loop can have multiple loop variables.

Why A: The break statement in Java is used to immediately terminate the execution of a loop (for, while, or do-while) and transfer control to the statement following the loop. This allows premature exit based on a condition, which is a fundamental control flow mechanism in Java.

Last reviewed: Jun 25, 2026

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.

Loading comments…

Sign in to join the discussion.

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.