Courseiva
Control Flow and LoopseasyMultiple SelectObjective-mapped

1Z0-811 Control Flow and Loops Practice Question

Which two control flow statements can be used to terminate a loop prematurely?

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

return

Options A (return) and D (break) are correct. The return statement terminates the enclosing method, thereby ending the loop. The break statement directly terminates the innermost loop. Option B (exit) is not a Java statement; System.exit() is a method but it is not a control flow statement for loop termination. Option C (System.gc()) is a garbage collection hint and does not affect loop control. Option E (continue) skips the current iteration but does not terminate the loop.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • return

    Why this is correct

    return exits the method, which terminates the loop as well.

  • exit

    Why it's wrong here

    exit is not a Java keyword; System.exit is a method that terminates the JVM.

  • System.gc()

    Why it's wrong here

    System.gc() suggests garbage collection, does not affect loop control flow.

  • break

    Why this is correct

    break exits the loop immediately.

  • continue

    Why it's wrong here

    continue only skips the current iteration, does not terminate the loop.

About these practice questions

One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.