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 10: Recursion
Start Practice Test
Share
easy Solved by 3 students
Nested For Loop Iteration Count
< Prev
Next >

How many times will the println statement be executed by the following code segment?

for (int i = 1; i <= 3; i++) {
    for (int j = i; j <= 5; j++) {
        System.out.println(i + "-" + j);
    }
}
A

10

B

9

C

11

D

12

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1singhris00011 0m 49s 51
#2bommasam00036 4m 09s 21
#3chasequest801 0m 03s -13
#4richa.tuli01 0m 25s -35
APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy