| 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
< Prev
Next >

An automated delivery truck checks that both its left and right doors satisfy safety conditions before departure. What is the output of the code?

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

2, 6

B

3, 6

C

2, 4

D

3, 5

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.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

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