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 1 students

2D Array Column-Major Traversal

Mark
< Prev
Next >

What is the output produced by the execution of the following code segment?

String[][] data = {
    {"AA", "BB"},
    {"CC", "DD"},
    {"EE", "FF"},
    {"GG", "HH"}
};
for (int col = 0; col < data[0].length; col++) {
    for (int row = 0; row < data.length; row++) {
        System.out.print(data[row][col] + " ");
    }
    System.out.println();
}
A

BB FF DD HH
AA EE CC GG

B

AA CC EE GG
HH FF DD BB

C

CC AA
DD BB
FF EE
HH GG

D

AA CC EE GG
BB DD FF HH

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|