AP Computer Science A — Mastering 2D Arrays (Data Collections)

0.0(0)
Studied by 0 people
0%Unit 4 Mastery
0%Exam Mastery
Build your Mastery score
multiple choiceMultiple Choice
call kaiCall Kai
Supplemental Materials
Card Sorting

1/24

Last updated 3:08 PM on 3/12/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

25 Terms

1
New cards

2D array

A Java structure that stores values in a grid of rows and columns, accessed with two indices (row and column).

2
New cards

Array of arrays

How Java implements a 2D array: the outer array holds references to inner arrays (rows).

3
New cards

Outer array

In a 2D array, the top-level array whose elements are the row arrays; its length is the number of rows.

4
New cards

Inner array (row)

In a 2D array, an element of the outer array that stores the columns for one row.

5
New cards

Rectangular 2D array

A 2D array where every row has the same number of columns.

6
New cards

Ragged (jagged) array

A 2D array where different rows can have different lengths because each row is a separate inner array.

7
New cards

0-indexed

Java arrays start at index 0; valid indices run from 0 to length − 1.

8
New cards

2D array declaration

The statement that defines a 2D array variable’s type (e.g., int[][] grid;), without allocating storage yet.

9
New cards

2D array allocation

Using new to create the grid structure in memory (e.g., new int[3][4] for 3 rows and 4 columns).

10
New cards

Initializer list

A literal way to create and fill a 2D array at once (e.g., int[][] a = {{1,2},{3,4}};).

11
New cards

Default array values

Values automatically placed in a newly allocated array: numbers default to 0, booleans to false, and object references to null.

12
New cards

Element access (grid[r][c])

Reading or writing a specific cell in a 2D array using row index r first, then column index c.

13
New cards

grid.length

The number of rows in a 2D array (the length of the outer array).

14
New cards

grid[r].length

The number of columns in row r (the length of the inner array at index r).

15
New cards

ArrayIndexOutOfBoundsException

A runtime error that occurs when code uses an index that is outside the valid range for an array.

16
New cards

Row-major order traversal

Visiting a 2D array row by row: outer loop over rows, inner loop over columns in that row.

17
New cards

Column-major order traversal

Visiting a 2D array column by column: outer loop over columns, inner loop over rows (generally safest for rectangular arrays).

18
New cards

Enhanced for loop (for-each)

A loop style that iterates through rows and elements without explicit indices; convenient for read-only traversals.

19
New cards

Accumulator

A variable (like sum, count, or max) updated during traversal to build a final result.

20
New cards

Off-by-one error

A boundary mistake where a loop goes one step too far (often from using <= instead of <).

21
New cards

Integer division

Division between ints that truncates the decimal part; avoided in averages by casting (e.g., (double)sum / count).

22
New cards

Early return

Returning from a method as soon as the answer is determined (e.g., return true when a target is found).

23
New cards

In-place modification

Changing the original 2D array’s elements directly inside a method (no new array returned is required).

24
New cards

Boundary check (neighbor access)

Verifying indices are in range before referencing adjacent cells (e.g., avoiding r-1 at the top row or c+1 at the right edge).

25
New cards

Null-safe String comparison

Using a literal’s equals method (e.g., "X".equals(seats[r][c])) to avoid NullPointerException when the cell could be null.

Explore top notes

note
Ch 30 - Barriers to Development
Updated 1071d ago
0.0(0)
note
Social Learning Theory
Updated 415d ago
0.0(0)
note
Nervous System Part 1
Updated 392d ago
0.0(0)
note
AP PSYCH 2.9 Sleep and Dreaming
Updated 1062d ago
0.0(0)
note
DNA Repair
Updated 1310d ago
0.0(0)
note
Chapter 9 Agriculture Topics
Updated 1115d ago
0.0(0)
note
Ch 30 - Barriers to Development
Updated 1071d ago
0.0(0)
note
Social Learning Theory
Updated 415d ago
0.0(0)
note
Nervous System Part 1
Updated 392d ago
0.0(0)
note
AP PSYCH 2.9 Sleep and Dreaming
Updated 1062d ago
0.0(0)
note
DNA Repair
Updated 1310d ago
0.0(0)
note
Chapter 9 Agriculture Topics
Updated 1115d ago
0.0(0)

Explore top flashcards

flashcards
Cell Organelles
21
Updated 377d ago
0.0(0)
flashcards
Midterm Vocabulary - Bio 20 AP
143
Updated 282d ago
0.0(0)
flashcards
Harrison History Chapter 3
58
Updated 539d ago
0.0(0)
flashcards
Sport, Spiel, und Spaß
60
Updated 189d ago
0.0(0)
flashcards
MAME Final
197
Updated 469d ago
0.0(0)
flashcards
Tejido nervioso
58
Updated 1002d ago
0.0(0)
flashcards
Cell Organelles
21
Updated 377d ago
0.0(0)
flashcards
Midterm Vocabulary - Bio 20 AP
143
Updated 282d ago
0.0(0)
flashcards
Harrison History Chapter 3
58
Updated 539d ago
0.0(0)
flashcards
Sport, Spiel, und Spaß
60
Updated 189d ago
0.0(0)
flashcards
MAME Final
197
Updated 469d ago
0.0(0)
flashcards
Tejido nervioso
58
Updated 1002d ago
0.0(0)