1Z0-811 · topic practice

Control Flow and Loops practice questions

Practise Oracle Java Foundations 1Z0-811 Control Flow and Loops practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Reviewed byJohnson Ajibi· MSc IT Security
20 questionsDomain: Control Flow and Loops

What the exam tests

What to know about Control Flow and Loops

Control Flow and Loops questions test whether you can apply the concept in context, not just recognise a definition.

How the topic appears in realistic exam-style scenarios.

Which detail in the question changes the correct answer.

How to eliminate plausible but wrong options.

How to connect the question back to the wider exam objective.

Watch out for

Common Control Flow and Loops exam traps

  • Answering from memory before reading the full scenario.
  • Missing a constraint such as cost, availability, security, scope or command context.
  • Choosing a broad answer when the question asks for the most specific fix.
  • Ignoring why the wrong options are tempting.

Practice set

Control Flow and Loops questions

20 questions · select your answer, then reveal the explanation

A developer writes a loop to iterate over an array of integers. The loop must sum all elements and stop early if the sum exceeds 100. Which control flow construct should be used?

Which loop is guaranteed to execute its body at least once?

A developer needs to implement a menu-driven program that repeatedly displays options, reads input, and processes the choice until the user selects 'Exit'. Which loop structure and control flow is most appropriate?

What is the output of the following code?

int i = 0;
while (i < 5) {
    if (i == 3) {

i++; continue;

}

System.out.print(i + " "); i++;

}

Which statement about the for-each loop in Java is true?

A developer writes: for(int i=0; i<10; i++) { if(i%2==0) continue; System.out.print(i); }. What is the output?

Which loop best suits a scenario where the number of iterations is unknown and depends on user input?

Which TWO statements are true about the switch statement in Java? (Choose two.)

Which THREE statements are true about the break and continue statements in Java? (Choose three.)

What is the output of the code?

Exhibit

Refer to the exhibit.

for (int i = 0; i < 5; i++) {
    if (i == 2) {
        continue;
    }
    System.out.print(i + " ");
}

What is the value of sum printed?

Exhibit

Refer to the exhibit.

int sum = 0;
for (int i = 1; i <= 10; i++) {
    if (i % 3 == 0) {
        break;
    }
    sum += i;
}
System.out.println(sum);

You are tuning a real-time data processing application that reads sensor data from a queue. The system must process each sensor reading, but occasionally a reading is invalid (null) and should be skipped. The loop must run indefinitely until the application is shut down gracefully. The current implementation uses a while(true) loop with a break condition when a shutdown flag is set. However, the loop is consuming excessive CPU because it continuously polls the queue even when no data is available. You need to modify the loop to reduce CPU usage while still processing data efficiently. Which approach should you take?

Arrange the steps to define a class with a main method in Java in the correct order.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5

Match each Java operator to its description.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Increment by 1

Modulo (remainder) operator

Logical AND (short-circuit)

Checks if an object is of a certain type

Ternary conditional operator

A developer needs to iterate over an array of integers and compute the sum of its elements. Which loop construct is most appropriate for this task?

A programmer writes a switch statement to handle different cases. The code compiles and runs, but the output is unexpected: 'A' prints when the input is 'B'. Which is the most likely cause?

In a nested loop structure, a developer wants to exit completely from the outer loop when a certain condition is met inside the inner loop. Which approach is correct?

Which TWO of the following are valid loop constructs in Java?

Which THREE of the following are valid types that can be used as a switch expression in Java (as of Java 8)?

Which TWO statements about the enhanced for loop (for-each) are correct?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Control Flow and Loops sessions

Start a Control Flow and Loops only practice session

Every question in these sessions is drawn from the Control Flow and Loops domain — nothing else.

Related practice questions

Related 1Z0-811 topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the 1Z0-811 exam test about Control Flow and Loops?
Control Flow and Loops questions test whether you can apply the concept in context, not just recognise a definition.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Control Flow and Loops questions in a focused session?
Yes — the session launcher on this page draws every question from the Control Flow and Loops domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other 1Z0-811 topics?
Use the topic links above to move to related areas, or go back to the 1Z0-811 question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the 1Z0-811 exam covers. They are not copied from any real exam or dump site.