| preferred AP College board partner for AP classes
AP Computer Science A/Unit 8: 2D Array
Start Practice TestPractice Test
About Exam
medium Solved by 7 students
2D Array Anti-Diagonal Traversal
< Prev
Next >

What is the value of sum after the following code segment is executed?

int[][] cells = {
{4, 1, 7},
{6, 5, 3},
{2, 8, 0}
};

int sum = 0;
for (int x = 0; x < cells.length; x++) {
      sum += cells[x][cells[0].length - 1 - x];
}
A

14

B

15

C

18

D

10

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

Question Leaderboard

Not enough data yet to show leaderboard.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

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