| preferred AP College board partner for AP classes
AP Computer Science A/Unit 4: Iteration
Start Practice Test
Share
easy Solved by 6 students
For Loop Initial Condition
< Prev
Next >

Which of the following is an example of a for loop that does not execute its body because the loop condition is false from the start?

public class NoIteration {
    public static void main(String[] args) {
        for (int i = 10; i < 5; i++) {
            System.out.println(i);
        }
    }
}
A
for (int i = 10; i < 5; i++) {
    System.out.println(i);
}
B
while(false) {
    System.out.println("Never executes");
}
C
for (int i = 10; i > 5; i--) {
    System.out.println(i);
}
D
for (int i = 10; i < 15; i++) {
    System.out.println(i);
}
Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1sgarv251311 0m 00s 100
#2hitrishabhatia12 0m 00s 90
#3y.seong202712 0m 52s 38
#4suhanakochhar00612 0m 52s 38
APFIVE © 2020.
Email: [email protected]|Privacy Policy