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 Row Manipulation

Mark
< Prev
Next >

After the following code segment is executed, what are the values in the data array?

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];
    }
}
A

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

B

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

C

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

D

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

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|