| preferred AP College board partner for AP classes
AP Computer Science A/Unit 4: Iteration
Start Practice TestPractice Test
About Exam
easy Solved by 11 students
For Loop Accumulator Variable
< Prev
Next >

Consider the following code segment. What value is printed when the code is executed?

public class Savings {
    public static void main(String[] args) {
        int total = 0;
        for(int day = 1; day <= 7; day++) {
            total += day * 2;
        }
        System.out.println(total);
    }
}
A

54

B

56

C

49

D

28

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1hadleysmith522 0m 00s 200
#2hitrishabhatia11 0m 00s 100
#3sgarv251311 0m 00s 100
#4mertdeg14 0m 00s 70
#5y.seong202711 0m 44s 56
#6midnightasdark12 1m 43s -13
#7gtsak3111 2m 50s -70
#8suhanakochhar00611 9m 19s -459
#9Pelisx11 25m 55s -1,455
Items per page:
10
1 – 9 of 9
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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