What this deck covers
This deck focuses on 2d Array Traversals, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.
Study 2d Array Traversals in AP Computer Science a with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.
0% Complete
Identify the method to iterate over a 2D array using enhanced for-loops.
Tap card or press Space to flip
for (int[] row : array). Enhanced for-loop iterates over each row as an array.
How well did you know it?
Card 1 / 67
Space to flip · ← / → to move · once flipped, → Got it · ← Still learning
This deck focuses on 2d Array Traversals, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.
Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.
Answer: for (int[] row : array). Enhanced for-loop iterates over each row as an array.
Answer: array[0].length. Accesses the length of the first row to get column count.
Answer: false. Boolean arrays initialize all elements to false by default.
Answer: array[0].length. Accesses the length of the first row to get column count.
Answer: int[][] array = { {1, 2}, {3, 4} };. Direct initialization with literal values 1 through 4.
Answer: for (int j = 0; j < array[i].length; j++). Iterates through columns in current row i.
Answer: 3 rows, undefined column sizes. Creates row array without specifying column dimensions.
Answer: new. Required keyword to allocate memory for array objects.
Answer: Number of rows. Returns the count of rows in the array.
Answer: new. Essential keyword for creating array objects in memory.
Answer: int. Declaration specifies integer as the element type.
Answer: To iterate over all elements. Enables systematic access to every array element.
Answer: for (int j = 0; j < array[i].length; j++). Iterates through columns in current row i.
Answer: Length of third row. Returns column count specifically for row at index 2.
Answer: Correct: arr must be initialized before access. Array must be instantiated with 'new' before access.
Answer:
Answer: Total number of elements. Multiplies rows by columns for rectangular arrays.
Answer: Last element in the first row. Uses length-1 to get the rightmost column index.
Answer: To iterate over all elements. Enables systematic access to every array element.
Answer: Row index. Outer loop variable controls row position first.
Answer: Correct: arr must be initialized before access. Array must be instantiated with 'new' before access.
Answer: Traversal. The systematic process of visiting each element in order.
Answer:
Answer: Row index. Outer loop variable controls row position first.
Answer: array[1][2] = value;. Arrays use zero-based indexing, so row 2 is index 1.
Answer:
Answer: new. Essential keyword for creating array objects in memory.
Answer: ArrayIndexOutOfBoundsException. Standard runtime exception for bounds violations.
Answer: Last element in the first row. Uses length-1 to get the rightmost column index.
Answer: new. Required keyword to allocate memory for array objects.
Answer: ArrayIndexOutOfBoundsException. Runtime exception thrown when accessing invalid indices.
Answer: for (int[] row : array). Enhanced for-loop iterates over each row as an array.
Answer: Traversal. The systematic process of visiting each element in order.
Answer: Correct: arr[1][0] = 5;. Index 2 is out of bounds for 2-row array.
Answer: ArrayIndexOutOfBoundsException. Runtime exception thrown when accessing invalid indices.
Answer: Correct: 'new int[3][3]'. Missing type specification between 'new' and brackets.
Answer: Number of columns in the first row. Returns column count for the first row only.
Answer: for (int i = 0; i < array.length; i++). Iterates through each row using array.length.
Answer: int[][] array = { {1, 2}, {3, 4} };. Direct initialization with literal values 1 through 4.
Answer: Nested for-loops. Outer loop for rows, inner loop for columns.
Answer: array[i][j]. Uses row index i and column index j.
Answer: Total number of elements. Multiplies rows by columns for rectangular arrays.
Answer: int. Declaration specifies integer as the element type.
Answer: for (int i = 0; i < array.length; i++). Iterates through each row using array.length.
Answer: array.length. Returns the number of rows in the outer array dimension.
Answer: Correct: 'new int[3][3]'. Missing type specification between 'new' and brackets.
Answer: false. Boolean arrays initialize all elements to false by default.
Answer: Correct: arr[1][0] = 5;. Index 2 is out of bounds for 2-row array.
Answer: int[][] arrayName;. Standard declaration syntax using double brackets for 2D arrays.
Answer: int[][] arrayName;. Standard declaration syntax using double brackets for 2D arrays.
Answer: 3 rows, undefined column sizes. Creates row array without specifying column dimensions.
Answer:
Answer: Increment element at array[i][j] by 1. Adds 1 to the current value at that position.
Answer: Sum all elements in 2D array. Enhanced for-loops accumulate all array element values.
Answer: int[][] array = { {1, 2}, {3, 4} };. Initialization syntax using nested braces for values.
Answer: Sum all elements in 2D array. Enhanced for-loops accumulate all array element values.
Answer: Increment element at array[i][j] by 1. Adds 1 to the current value at that position.
Answer: int[][] array = { {1, 2}, {3, 4} };. Initialization syntax using nested braces for values.
Answer: Number of rows. Returns the count of rows in the array.
Answer: Number of columns in the first row. Returns column count for the first row only.
Answer: array[i][j]. Uses row index i and column index j.
Answer: array[1][2] = value;. Arrays use zero-based indexing, so row 2 is index 1.
Answer: Length of third row. Returns column count specifically for row at index 2.
Answer: Nested for-loops. Outer loop for rows, inner loop for columns.
Answer: Array is jagged, not rectangular. Rows have different lengths, creating irregular structure.
Answer: Array is jagged, not rectangular. Rows have different lengths, creating irregular structure.
Answer: ArrayIndexOutOfBoundsException. Standard runtime exception for bounds violations.