| preferred AP College board partner for AP classes
AP Computer Science A/Unit 2: Using Objects
Start Practice TestPractice Test
Share
About Exam
medium Solved by 4 students
Nested For Loop Execution Count
< Prev
Next >

In the nested loops above, how many total iterations does the innermost statement execute?

public class LoopTest {
    public static void main(String[] args) {
        int count = 0;
        for (int i = 1; i <= 4; i++) {
            for (int j = 0; j < i; j++) {
                count++;
            }
        }
        System.out.println(count);
    }
}
A

4

B

12

C

10

D

8

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1kaisuki11 0m 00s 100
#2bommasam00013 0m 49s 31
#3richa.tuli01 2m 01s -131
#4lsj0803092211 2h 37m -9,374
Items per page:
10
1 – 4 of 4

AI Tutor

How can I help?

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