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
easy Solved by 1 students

Populating a 2D Array with Nested Loops

Mark
< Prev
Next >

Consider the following code segment.

int[][] data = new int[3][3];
for (int m = 0; m < data.length; m++)
{
    for (int n = 0; n < data[0].length; n++)
    {
        data[m][n] = m * n;
    }
}

What are the contents of the data array after this code segment is executed?

A

0 0 0
0 1 2
0 2 4

B

1 1 1
2 2 2
3 3 3

C

0 1 2
0 2 4
0 3 6

D

1 2 3
2 4 6
3 6 9

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|