| preferred AP College board partner for AP classes
AP Computer Science A/Unit 8: 2D Array
Start Practice Test
Share
medium Solved by 3 students
2D Array Nested Loop Traversal
< Prev
Next >

Consider the following code segment.

int[][] points = {{11, 12, 13, 14, 15},
                  {21, 22, 23, 24, 25},
                  {31, 32, 33, 34, 35},
                  {41, 42, 43, 44, 45}};

for (int row = 0; row < points.length; row++)
{
    for (int col = points[0].length - 1; col >= row; col--)
    {
        System.out.print(points[row][col] + " ");
    }
    System.out.println();
}

What is printed when this code segment is executed?

A

15 14 13 12 11
25 24 23 22 21
35 34 33 32 31
45 44 43 42 41

B

11 12 13 14 15
21 22 23 24
31 32 33
41 42

C

15 14 13 12 11
25 24 23 22
35 34 33
45 44

D

15 14 13 12
25 24 23
35 34
45

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

Question Leaderboard

Not enough data yet to show leaderboard.

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