AP Computer Science A Flashcards: 2D Array Traversals
Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026
Review key ideas with interactive flashcards. This set includes 10 cards to help you master important concepts.
What programming construct is used to traverse and access elements in a 2D array?
Nested iteration statements are used to traverse and access all or an ordered sequence of elements in a 2D array.
Card 1 of 10
All Flashcards (10)
What programming construct is used to traverse and access elements in a 2D array?
Nested iteration statements are used to traverse and access all or an ordered sequence of elements in a 2D array.
What is the default traversal order when using a nested enhanced for loop on a 2D array?
A nested enhanced for loop naturally traverses a 2D array in row-major order.
How are the rows and the elements within a row accessed in a nested enhanced for loop?
The outer loop accesses each row, and for each of those rows, the inner loop accesses every element within that specific row.
In a nested enhanced for loop used to traverse a 2D array, what does the outer loop traverse?
The outer loop of a nested enhanced for loop traverses the rows of the 2D array.
What is column-major order?
Column-major order is a traversal method that processes all elements of the first column, then all elements of the second column, and continues column by column.
Name two standard orders for traversing a 2D array using nested iteration statements.
Nested iteration statements can be written to traverse a 2D array in row-major order or column-major order.
What is row-major order?
Row-major order is a traversal method that processes all elements of the first row, then all elements of the second row, and continues row by row.
In a nested enhanced for loop for a 2D array, what does the inner loop traverse?
The inner loop traverses the elements within a single row, which was accessed by the outer loop.
Are traversals of 2D arrays limited to only row-major and column-major order?
No, nested iteration statements can be written to traverse a 2D array in a uniquely defined order.
What is the ultimate goal when developing code that traverses the elements in a 2D array?
The goal is to not only traverse the elements but also to determine the result of the traversal, such as finding a sum, an average, or a specific element.