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
easy Solved by 2 students

While Loop With Compound Condition

Mark
< Prev
Next >

The following code segment models a safety check for an automated delivery truck. What is printed when the code is executed?

public class DeliveryCheck {
    public static void main(String[] args) {
        int leftDoor = 0;
        int rightDoor = 0;
        while(leftDoor < 3 && rightDoor < 5){
            leftDoor++;
            rightDoor += 2;
        }
        System.out.println(leftDoor + ", " + rightDoor);
    }
}
A

3, 6

B

2, 6

C

3, 5

D

2, 4

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|