| preferred AP College board partner for AP classes
AP Computer Science A/Unit 4: Iteration
Start Practice TestPractice Test
Share
About Exam
medium Solved by 1 students
Break Statement In A Nested Loop
< Prev
Next >

All of the following statements about the nested loops above are true except:

public class NestedBreak {
    public static void main(String[] args) {
        for(int i = 0; i < 3; i++) {
            for(int j = 0; j < 3; j++) {
                if(i == j) {
                    break;
                }
                System.out.print(i + "," + j + " ");
            }
        }
    }
}
A

The code only prints pairs (i, j) when i is not equal to j until the break condition is met.

B

The break statement inside the inner loop causes premature termination when i equals j.

C

The inner loop executes fully for every iteration of the outer loop without interruption.

D

The behavior of the nested loops is influenced by both i and j, especially due to the break condition.

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy