| 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 [][] data = {
    {3, 6, 9, 12}, 
    {15, 18, 21, 24}, 
    {27, 30, 33, 36}
};

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

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

A

3 6 9 12
3 6 9 12
3 6 9 12

B

27 30 33 36
27 30 33 36
27 30 33 36

C

3 6 9 12
15 18 21 24
27 30 33 36

D

36 33 30 27
24 21 18 15
12 9 6 3

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