Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 2: Using Objects
Start Practice TestPractice Test
About Exam
medium Solved by 5 students

Nested For Loop Execution Count

< Prev
Next >

Consider the following code segment. What is the total number of times the statement count++ is executed?

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

8

B

12

C

4

D

10

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question
Mark for review

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1kaisuki11 0m 00s 100
#2bommasam00013 0m 49s 31
#3richa.tuli01 2m 01s -131
#4zgj0731041701 2m 17s -147
#5chunxiangxu.cxu11 6m 48s -308
#6lsj0803092211 2h 37m -9,374
Items per page:
10
1 – 6 of 6
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|