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

Consider the following code segment. What is printed when the code segment is executed?

int[][] matrix = { {1, 2}, {3, 4} };
for (int i = 0; i < matrix.length; i++) {
    for (int j = 0; j < matrix[i].length; j++) {
        matrix[i][j] += 1;
    }
}
System.out.println(matrix[1][1]);
A

6

B

5

C

4

D

1

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1ahsan4810522 0m 00s 200
#2y.seong202702 3m 49s -249
#3bommasam00025 7m 50s -300
APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy