Courseiva
Controlling Program FlowhardMultiple SelectObjective-mapped

1Z0-829 Controlling Program Flow Practice Question

Which THREE statements are true about the enhanced for loop in Java?

⚠ Common exam trap

It's easy for candidates to confuse the enhanced for loop's inability to modify the loop variable with a requirement to declare it final, or they mistakenly believe that structural modifications during iteration are safe.

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 enhanced for loop internally uses an iterator for collections.

The enhanced for loop (for-each) over a collection internally uses an Iterator obtained from the collection's iterator() method. This is specified in the Java Language Specification (JLS 14.14.2) and is the mechanism that allows sequential access to each element without exposing the iterator directly.

Answer analysis

Option-by-option breakdown

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

  • If the underlying collection is modified during iteration, the loop will continue without error.

    Why it's wrong here

    Modification typically throws ConcurrentModificationException.

  • The enhanced for loop internally uses an iterator for collections.

    Why this is correct

    For Iterable objects, it uses Iterator.

  • The enhanced for loop can iterate over arrays.

    Why this is correct

    It works for both arrays and Iterable.

  • The loop variable cannot be modified inside the loop body.

    Why this is correct

    The loop variable is effectively final and cannot be reassigned.

  • The loop variable must be declared final in the loop header.

    Why it's wrong here

    No explicit final required; it is effectively final.

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 →

How Courseiva writes practice questions · Editorial policy

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.