Are you taking CLEP classes? Try clep.ai
| 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 2 students

2D Array Anti-Diagonal Traversal

Mark
< 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

15

B

10

C

18

D

14

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.

AI Tutor

How can I help?

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