Double Dimensional Arrays Flashcards

1
Q

A 2D array is an _________________ that stores data in _____ and ___________.

A

array of arrays, rows, columns

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

Elements in a 2D array are accessed using two __________: the _____________ and the ______________

A

indices, row index, column index

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

When declaring a 2D array, you specify the __________ of the elements it will store and a ____________________ for the array

A

data type, reference variable

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

A 2D array where each row can have a different number of columns is called a ______________

A

jagged array

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

TRUE or FALSE

In Java, it is possible to initialize a double-dimensional array with only columns initialized; you must define rows first

A

False, it is not possible

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

__________________ storage means that elements of a 2D array are stored in memory __________.

This is used in languages like Java, C, and C++

A

Row-major order, row by row

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

Which of the following is a common application of 2D arrays mentioned in the source?

a) Representing linked lists
b) Representing matrices
c) Implementing stacks
d) Creating hash tables

A

b) Representing matrices

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

How does Java fundamentally treat a 2D array?

a) As a single block of memory with two offsets
b) As an array where each element is another array
c) As a collection of key-value pairs
d) As a tree-like data structure

A

b) As an array where each element is another array

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

In which memory storage order are 2D array elements typically accessed more efficiently in Java?
a) Row-Major Order
b) Column-Major Order
c) Diagonal Order
d) Reverse Row-Major Order

A

a) Row-Major Order

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

What is the primary purpose of using the Object[][] type for a 2D array in Java?

a) To improve memory efficiency
b) To enable automatic resizing of the array
c) To store elements of different data types
d) To simplify array indexing

A

c) To store elements of different data types

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

A 2D array where all rows have the same number of columns.

A

Rectangular Array

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

A 2D array where each row can have a different number of columns.

A

Jaggede Array

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

The process of going through each element of a 2D array, often using nested loops.

A

Traversal

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

The type of error that occurs when you try to access an element in a 2D array using an index that is outside the valid range of rows or columns.

A

ArrayIndexOutOfBoundsException

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

The order of storing 2D array elements in memory where all elements of the first column are stored consecutively, followed by the elements of the second column, and so on.

A

Column-Major Order

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

The order of storing 2D array elements in memory where all elements of the first row are stored consecutively, followed by the elements of the second row, and so on.

A

Row-Major Order

17
Q

The number of horizontal groupings of elements in a 2D array.

18
Q

The number of vertical groupings of elements in a 2D array.

19
Q

The act of assigning initial values to the elements of a 2D array when it is created.

A

Initialization

20
Q

A loop structure in Java that simplifies iterating over the elements of an array without explicitly using indices, but always processes 2D arrays in row-major order.

A

Enhanced For Loop