Courseiva
Java Basics and SyntaxhardMultiple ChoiceObjective-mapped

1Z0-811 Java Basics and Syntax Practice Question

Given the loop: for (int i=0; i<5; i++) { if (i==2) continue; System.out.print(i); } What is the output?

⚠ Common exam trap

The 1Z0-811 exam often tests the distinction between 'continue' and 'break' in loops, and the trap here is that candidates may forget that 'continue' skips only the current iteration, not the entire loop, leading them to incorrectly include or exclude values.

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

0134

The loop iterates i from 0 to 4. When i equals 2, the 'continue' statement skips the rest of that iteration, so 'System.out.print(i)' is not executed for i=2. Therefore, the output is 0, 1, 3, 4 concatenated as '0134'. Options A and C both display '0134' and are therefore correct. Option B shows '0124' (missing 3) and Option D shows '01234' (includes 2), both incorrect.

Answer analysis

Option-by-option breakdown

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

  • 0134

    Why this is correct

    Correct: 'continue' skips printing when i==2, so the output is 0134.

  • 0124

    Why it's wrong here

    Incorrect: Shows 0124, which erroneously includes 2 and misses 3.

  • 0134

    Why this is correct

    Correct: This option is identical to A and also shows the correct sequence 0134.

  • 01234

    Why it's wrong here

    Incorrect: Shows 01234, which includes i=2, not skipped.

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.