Courseiva
Control Flow and LoopsmediumMultiple SelectObjective-mapped

1Z0-811 Control Flow and Loops Practice Question

Which THREE are valid loop constructs in Java? (Choose three.)

⚠ Common exam trap

Oracle often tests the recognition of valid Java syntax versus constructs from other languages, so candidates may mistakenly select `repeat-until` or `loop` if they are familiar with other programming languages or do not recall Java's exact loop keywords.

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

while (condition) { }

The `while` loop is a standard Java construct that repeatedly executes a block of code as long as the specified boolean condition evaluates to `true`. The syntax `while (condition) { }` is valid even with an empty body, as the condition is checked before each iteration.

Answer analysis

Option-by-option breakdown

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

  • while (condition) { }

    Why this is correct

    Standard while loop.

  • repeat { } until (condition);

    Why it's wrong here

    Not a Java keyword; Java uses do-while.

  • do { } while (condition);

    Why this is correct

    Valid do-while loop.

  • loop (condition) { }

    Why it's wrong here

    No such construct in Java.

  • for (initialization; condition; update) { }

    Why this is correct

    Standard for loop.

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 →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on 1Z0-811

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 of the following are valid loop constructs in Java? (Choose two.)

easy
  • A.do {} while (false);
  • B.while (true)
  • C.for each (int i : array) {}
  • D.loop (int i = 0; i < 10; i++) {}
  • E.for (int i = 0; i < 10; i++) {}

Why A: A valid do-while loop; the semicolon after the condition is required. Option E is a standard for loop. Option B is invalid because 'while (true)' lacks a loop body (statement or block). Option C uses incorrect syntax: 'for each' is not Java; the correct syntax is 'for (int i : array)'. Option D uses 'loop' which is not a Java keyword; the correct keyword is 'for'.

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.