| preferred AP College board partner for AP classes
AP Computer Science A/Unit 8: 2D Array
Start Practice TestPractice Test
Share
About Exam
medium Solved by 3 students
2D Array Row Manipulation
< Prev
Next >

Consider the following code:

int [][] values = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};

for (int r = values.length - 1; r > 0; r--)
{
    for (int c = 0; c < values[r].length; c++)
    {
        values[r - 1][c] = values[r][c];
    }
}

Which of the following represents the current values in the array?

A

12 11 10 9
8 7 6 5
4 3 2 1

B

5 6 7 8
9 10 11 12
9 10 11 12

C

9 10 11 12
9 10 11 12
9 10 11 12

D

1 2 3 4
1 2 3 4
1 2 3 4

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

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

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