Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 4: Iteration
Start Practice TestPractice Test
About Exam
hard

Unconventional For Loop Logic

Mark
< Prev
Next >

What is printed when the following code is executed?

public class FaultyFor {
    public static void main(String[] args) {
        for (int i = 0; i < 3; i = i) {
            System.out.print(i + " ");
            if(i < -10) break;
            i--;
        }
        System.out.println("Finished");
    }
}
A

Infinite loop with no output

B

0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 Finished

C

0 Finished

D

0 -1 -2 Finished

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

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|