APFIVE APFIVE | preferred AP College board partner for AP classes
AP Classes
AP Computer Science A
AP Human Geography
AP Comparative Government and Politics
AP European History
AP Macroeconomics
AP Microeconomics
AP Psychology
AP United States Government and Politics
AP United States History
AP Calculus AB
AP Calculus BC
AP Computer Science Principles
AP Precalculus
AP Statistics
AP Biology
AP Chemistry
AP Environmental Science
AP Chinese
AP Art History
AP English Literature
AP Research
AP Spanish Literature
AP Art & Design
AP World History: Modern
AP English Language
AP French
AP German
AP Japanese
AP Latin
AP Italian
AP Spanish Language
AP Music Theory
AP Physics 1
AP Physics 2
AP Physics C: Mechanics
AP Physics C: E&M
AP African American Studies
AP Computer Science A/Unit 4: Iteration
Start Practice Test
Share
easy Solved by 5 students
While Loop Output
< Prev
Next >

What is printed when the following code is executed?

public class LoopTest {
    public static void main(String[] args) {
        int count = 0;
        while(count < 3) {
            System.out.print(count + " ");
            count++;
        }
    }
}
A

0 1 2 3

B

1 2 3

C

0 1 2

D

Compilation Error

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
#2y.seong202711 0m 12s 88
#3hitrishabhatia14 0m 00s 70
APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy