Multidimensional Arrays Flashcards

(45 cards)

1
Q

A multi-dimensional array in Java is an _____ _______ ______

A

array of arrays

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

It helps represent data in a ____ ______-_____(e.g., rows and columns),
similar to a spreadsheet or a
chessboard.

A

table-like structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

It helps represent data in a table-like
structure (e.g., rows and columns),
similar to a _______or a
________.

A

spreadsheet or a chessboard.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Multi-dimensional arrays are useful when
you need to store data in _____ ____ or
model ______ ______

A

1.grid form
2.mathematical
3.matrices

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The most common type is the _____ ______,
which is like a_____ with ______ and
___________

A
  1. 2D array
  2. table with rows and
    columns
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

_____ also supports arrays with more than
two dimensions, like 3D arrays (arrays
of 2D arrays).

A

Java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A 1D array is a linear collection of elements of the same _____ (type).

A

Type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

arrays are less common and are mainly
used in ______ ______ such as
3D modeling, simulations, or scientific
computing

A
  1. 3D
  2. specialized applications
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Each row is an array of integers, so the structure is an array where each element is itself an _____

A

Array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A 1D array is stored in _____ memory locations (_________).

A

Continuous

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Static initialization is straightforward when you have _____ values (predefined).

A

Predefined

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

3D arrays are less common and are mainly
used in specialized applications such as
3D_______, ______, or _______ ________.

A

1.modeling
2. simulations
3. scientific computing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Java does not implement _____ ______ _____ internally like some other
languages. Instead, it’s an array of arrays, which means you can have jagged (uneven) arrays

A

true multidimensional arrays

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

You can use multi-dimensional arrays for things
like:

A
  1. Grids or maps
  2. Matrix operations
  3. Representing tabular data (rows and
    columns)
  4. Game boards (e.g., Sudoku or Tic-TacToe)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The _____ _____ (arr) holds the memory address of the first element.

A

reference variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Array elements are accessed by
______ ___ _______ from the reference
point.

A

incrementing the index

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

2D Array: An array of arrays (a______to an
array of arrays).

A

reference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

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.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

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.

A
  1. arr2D
    2.1D array
20
Q

The main array (arr3D) holds a _____ to
2D arrays (slices).
Each 2D array is stored separatel

21
Q

_____ Array:
1. A continuous block of memory for the array elements.
2. The reference holds the address of the first element

22
Q

______ 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.

23
Q

_____ 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.

24
Q

_________ ______ is straightforward when
you have predefined values.

A

Static initialization

25
_______ _______ provides flexibility when the values are calculated or assigned during runtime, making it the preferred choice in many situations.
Dynamic initialization
26
_____ Array: A linear collection of elements of the same type.
1D
27
Matrix addition and matrix subtraction are common operations performed using 2D arrays in _________ and _______ _____.
1.mathematics 2. computer graphics
28
3D Array Structure: The _______ is a_______ grid with three layers. Each layer has 3 rows, and each row contains 3 columns
1. voxelGrid 2. 3x3x3
29
3D Array Structure: The voxelGrid is a 3x3x3 grid with three layers. Each layer has_____ ____, and each row contains 3 columns.
3 rows
30
Filling the Grid: ____ _______fill the grid with values (like color codes)
Nested loops
31
____________: Use print statements or debugging tools to check the values of your indices and array elements during program execution. This can help identify issues in nested loops and other ______ ______.
Debugging logic errors
31
_________ _______ are essential for traversing multidimensional arrays in Java. _________ _____: Use two loops (one for rows and one for columns). _______ ______: Use three loops (one for depth, one for rows, and one for columns). You can access or modify array elements by using the correct indices inside these loops.
Nested Loops 2D Arrays 3D Arrays
31
2D Jagged Array: Rows can have a ________ number of _______.
different columns
32
____________ _______: Ensure that you don 't access an out-of-bounds index in your array to avoid _________________________.
1. Boundary Checking 2.ArrayIndexOutOfBoundsException
32
_________ Arrays: If the layers in your 3D array don't need to have the ____ ______ of rows and columns, you can use______ arrays.
Jagged same number jagged
32
You can access individual elements using _____ ______: matrix[0][1] = 10;
two indices
32
__________ : Avoid calculating the _________ ______ inside the _____. Store the length in a variable before the loop to improve efficiency
Optimization array length loop
32
__________ : Use _______ or ______for array dimensions instead of hardcoding them.
flexibility variables constants
33
________ : A ________is more readable when you don 't need the exact _______.
Readability for-each loop indices
34
If you don 't know the size at the start, consider ________ ________the array based on user input or calculations.
dynamically initializing
35
_________the Array Dimensions: Always ______ your array with the correct dimensions to ensure proper ______ ________.
Predefine initialize memory allocation
36
_____ Arrays: Perfect for representing ____ grids or multi-layered data (scientific simulations). Used in _____ matrix addition and other operations. Ideal for representing 3D environments or voxel data.
3d 3d 3d
36
_____ Arrays: Commonly used for tabular data storage (student grades, sales data). Useful in matrix operations (addition, subtraction). Used for game boards (chess, tic-tac-toe)
2d
37
A _______ is a 3D pixel, like a tiny cube that represents a block of space. Used in ____ _______, gaming, and ________ ________. A voxel grid is a _______ ____ of ______that form a 3D object or environment.
voxel 3D modeling medical imaging 3D array of voxels
38
_______Arrays: Multi-dimensional arrays where all sub-arrays (rows/columns) have the same length
rectangular