Multidimensional Arrays Flashcards
(45 cards)
A multi-dimensional array in Java is an _____ _______ ______
array of arrays
It helps represent data in a ____ ______-_____(e.g., rows and columns),
similar to a spreadsheet or a
chessboard.
table-like structure
It helps represent data in a table-like
structure (e.g., rows and columns),
similar to a _______or a
________.
spreadsheet or a chessboard.
Multi-dimensional arrays are useful when
you need to store data in _____ ____ or
model ______ ______
1.grid form
2.mathematical
3.matrices
The most common type is the _____ ______,
which is like a_____ with ______ and
___________
- 2D array
- table with rows and
columns
_____ also supports arrays with more than
two dimensions, like 3D arrays (arrays
of 2D arrays).
Java
A 1D array is a linear collection of elements of the same _____ (type).
Type
arrays are less common and are mainly
used in ______ ______ such as
3D modeling, simulations, or scientific
computing
- 3D
- specialized applications
Each row is an array of integers, so the structure is an array where each element is itself an _____
Array
A 1D array is stored in _____ memory locations (_________).
Continuous
Static initialization is straightforward when you have _____ values (predefined).
Predefined
3D arrays are less common and are mainly
used in specialized applications such as
3D_______, ______, or _______ ________.
1.modeling
2. simulations
3. scientific computing
Java does not implement _____ ______ _____ internally like some other
languages. Instead, it’s an array of arrays, which means you can have jagged (uneven) arrays
true multidimensional arrays
You can use multi-dimensional arrays for things
like:
- Grids or maps
- Matrix operations
- Representing tabular data (rows and
columns) - Game boards (e.g., Sudoku or Tic-TacToe)
The _____ _____ (arr) holds the memory address of the first element.
reference variable
Array elements are accessed by
______ ___ _______ from the reference
point.
incrementing the index
2D Array: An array of arrays (a______to an
array of arrays).
reference
1D Array: An array of arrays (a reference to an
array of arrays).
Memory Layout:
The first reference points to an array of rows
(arrays).
Each row (array) is stored separately in
memory.
int[][] arr2D = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };
The reference (______) holds the address of
the array of arrays.
Each row (_____) is stored at a different
memory location.
- arr2D
2.1D array
The main array (arr3D) holds a _____ to
2D arrays (slices).
Each 2D array is stored separatel
reference
_____ Array:
1. A continuous block of memory for the array elements.
2. The reference holds the address of the first element
1D
______ Array:
1. An array of arrays; the main reference points to an array of
1D arrays.
2. Each row (1D array) is stored at a different memory
location.
2D
_____ Array:
1. An array of arrays of arrays; the main reference points to
an array of 2D arrays.
2. Each 2D array (slice) is stored at a different memory
location.
3D
_________ ______ is straightforward when
you have predefined values.
Static initialization