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

What is printed as a result of executing the following code segment?

public class Main {
    public static void main(String[] args) {
        int[][] matrix = { {1, 2}, {3, 4}, {5, 6} };
        for (int i = 0; i < matrix.length; i++) {
            System.out.print(matrix[i][0] + " ");
        }
    }
}
A

2 4 6

B

No output

C

1 3 5

D

1 2 3

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1upadhgau00022 0m 00s 200
#2kaisuki11 0m 00s 100
#3y.seong202701 4m 13s -263
APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy