| 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 10 students
2D Array Traversal Output
< Prev
Next >

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

public class Main {
    public static void main(String[] args) {
        int[][] array = { {1, 2, 3}, {4, 5, 6} };
        for (int[] row : array) {
            for (int num : row) {
                System.out.print(num + " ");
            }
        }
        System.out.println();
    }
}
A

1 2 3 4 5 6

B

4 5 6

C

Compilation Error

D

1 2 3

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1kaisuki11 0m 00s 100
#2y.seong202711 0m 29s 71
#3bommasam00011 4m 32s -172
Items per page:
10
1 – 3 of 3
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy