Array Flashcards

1
Q

A _____________ is a way of organizing and
storing data so that it can be accessed and
modified efficiently.

A

data structure

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

________ in Java are __________(consisting of
parts all of the same kind.) data structures
implemented in Java as objects.

A

Arrays
homogeneous

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

A specific element in an array is accessed by its
_______. Arrays offer a convenient means of grouping
related information.

A

index

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

An ________ in an array is a single value stored at a
particular position. Each element shares the same
data type as the array.

A

element

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

An __________ is the position of anelement inside an array. In Java, array indices start from 0 (not 1).

A

index (plural: indices)

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

A __________ is the physical address in
computer memory (RAM) where an array stores its
elements.

A

memory location

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

What are the typesof Java Array

A

Single Dimensional Array
Double Dimensional Array
Multi Dimensional Array

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

You can imagine a 1D array as a row, where elements are stored one
after another.

A

Single Dimensional Arrays

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

A two-dimensional (2D) array can be visualized as a table or a matrix. It contains rows and columns.

A

Double Dimensional Arrays

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

Each element is initialized to a default value, a process known as _________. ____________ is initialization of variables to a default value, as in the initialization of array elements when an array is __________.

A

auto-initialization
Auto-Initialization
constructed

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

A ______________ in Java
is a structured way of storing multiple
values of the same data type under a
single variable name.

A

one-dimensional array (1D array)

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

The enhanced for loop, also called the _______, is a simplified way to iterate through arrays and collections. It eliminates the need for index tracking, making the code cleaner and easier to read.

A

for each loop

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

Accessing an index that is outside the valid range of the array causes a
runtime error.

A

Array Index Out of Bounds Exception

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

Arrays have a fixed size—once created, they cannot grow or
shrink.

A

Fixed Size Limitation

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

Java provides various utility methods to work with
arrays through the Arrays class in the java.util
package. These methods help with______,
_______, _____, _______, and _________
arrays efficiently.

A

sorting
searching
copying
comparing
filling

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

The equals() method checks if
two arrays contain the same
elements in the same order.

A

Arrays.equals()

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

The sort() method sorts an array in
ascending order.

A

Arrays.sort() –

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

The fill() method sets all elements in an array to a
specific value.

A

Arrays.fill()

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

The copyOf() method creates a new array with the
same elements as the original.

A

Arrays.copyOf()

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

is used to
search for an element in a sorted array efficiently.

A

Arrays.binarySearch() method

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

method is used
to convert a String into a
character array (char[])

A

toCharArray()

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

A ________ is an array of arrays.
It stores data in rows and columns
(tabular format).

A

2D array

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

Elements are accessed using two
indices: row index and column index.
Also called __________
because they use more than one
dimension (row and column).

A

multidimensional arrays

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

Elements are stored row by row in
memory.

A

Row-Major Order

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

Elements are stored column by column in
memory

A

Column-Major Order

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

_______ are stored in contiguous memory
locations.

A

Arrays

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

Arrays are stored in _________________.

A

contiguous memory
locations

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

Elements are accessed using ____________.

A

numeric
indexing

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

A ____________ 2D array stores elements
of different data types.

A

heterogeneous

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

Gives the number of rows in the 2D array.

A

numbers.length

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

Iterates over each row before moving to
the next.

A

Row-Major Order Traversal

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

Iterates over each column before moving to
the next.

A

Column-Major Order Traversal

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

2D array is an array of _____.

A

arrays

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

It stores data in ____ and ____ (tabular format).

A

rows
columns

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

It stores data in rows and column (_____).

A

tabular format

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

Elements are accessed using two indices.______ and ______

A

Row index and column index

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

What is columns

A

Vertical Elements

39
Q

______ are accessed using two indices

40
Q

2D is also called__________ because they use more than one dimensions.

A

Multidimensional arrays

41
Q

2D is commonly used in programming to ______ and______ data.

A

Store
Manipulate

42
Q

What is rows?

A

Horizontal elements

42
Q

Java treats a 2D array as a _______ of 1D arrays.

A

collection

43
Q

Each row in a 2D array is _____ to 1D array.

44
Q

Syntax for declaring 2D array:

A

Two square brackets

45
Q

Specify the number of rows but leave columns uninitialized.

A

Double-Dimensional array with only rows initialized.

46
Q

Creates a _________(rows can have different column sizes).

A

Jagged array

47
Q

Arrays are stored in __________.

A

contagious memory locations.

48
Q

Elements are accessed 1using _______

A

numeric indexing

49
Q

____________ in Java are like the basic units or building
blocks of a Java program.

50
Q

A method is a ___________ that performs a
specific task or operation.

A

group of code

51
Q

A method is a group of code that performs a
____________.

A

specific task or operation

52
Q

a method is a collection of
__________ that work together to complete
a particular job.

A

statements

53
Q

Applications of 2D Arrays:

Used in mathematics to represent
__________ and ________.

A

matrices
complex data structures

54
Q

____________

Can store:
______
________
Other types of data.

A

Images.
Text.

55
Q

Applications of 2D Arrays:

Useful for __________ and
___________.

A

data analysis
visualization

56
Q

Java treats a __________ as a collection of
1D arrays.

57
Q

Java treats a 2D array as a collection of
___________.

58
Q

A 2D array in Java has rows and
columns, requiring ______ indices:

One for the _______.
One for the _______.

A

two
row
column

59
Q

Syntax for declaring a 2D array

________: Type of values the array can store (e.g., int,
char).

60
Q

Syntax for declaring a 2D array

________: Reference variable for the 2D array
object.

61
Q

Ways to Initialize a 2D Array

______________:
Assign values directly during
declaration.

A

Static Initialization

62
Q

Ways to Initialize a 2D Array

____________:
Set the size first, then assign values
later.

A

Dynamic Initialization

63
Q

Types of 2D Array Initialization

  1. Double-Dimensional Array with Only Rows Initialized

Specify the number of rows but leave columns
__________.

A

uninitialized

64
Q
  1. Double-Dimensional Array with Only Rows Initialized

Creates a j_________(rows can have different column sizes).
Useful for _________________ (e.g., storing words of different
lengths).

A

jagged array
flexible structures

65
Q

Types of 2D Array Initialization

___________________________:

Not possible in Java.
You must define rows first because a 2D array is an array
of arrays.
Columns are defined per row.

A

Double-Dimensional Array with Only Columns Initialized

66
Q

Types of 2D Array Initialization

1.__________________:

Specify the number of rows but leave columns uninitialized.
Creates a jagged array (rows can have different column sizes).
Useful for flexible structures (e.g., storing words of different
lengths).
Initialize each row with a different number of columns

A

Double-Dimensional Array with Only Rows Initialized

67
Q

Types of 2D Array Initialization

3.______________________________:

Declare a 2D array without initializing rows or columns.
This is just a _________; no memory is allocated yet.
Must initialize before use.

A

Double-Dimensional Array with No Rows or Columns
Initialized

reference

68
Q

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

A

jagged array

69
Q

A jagged array is a 2D array where
each row can have a different number of
___________

70
Q

Unlike regular 2D arrays, jagged
arrays are not ____________.
Useful when the data structure is
__________ (e.g., varying number of
subjects per student).

A

rectangular
irregular

71
Q

Declaring and Initializing a Heterogeneous
2D Array

A heterogeneous 2D array stores ___________
of __________.

A

elements
different data types

72
Q

Declaring and Initializing a Heterogeneous
2D Array

A ___________ stores elements
of different data types.

A

heterogeneous 2D array

73
Q

Java arrays are _______ by ______all
elements must be of the same type).

A

homogeneous
default (

74
Q

To achieve __________, we use a
workaround involving the Object class

A

heterogeneity

75
Q

To achieve heterogeneity, we use a
workaround involving the _____

A

Object class

76
Q

To achieve heterogeneity, we use a ______ involving the Object
class.

A

workaround

77
Q

How to Achieve Heterogeneity in Java

Use the ________:
The Object class is the root of Java’s class ________.
By declaring a 2D array as Object[][], we can store
_______ of any type.

A

Object class
hierarchy
elements

78
Q

Declaring and Initializing a Heterogeneous
2D Array
Declare the array as _______
Assign ______ of different types

A

Object[][]
values

79
Q

Accessing 2d Array Elements
Since the array is of type Object, you must
_________ elements back to their
original types when _____ them

A

cast(typecasting)
accessing

80
Q

Looping Through a 2D Array
Use ________ (a loop inside another loop)
to _______ all elements of a 2D array.
______: Iterates over the rows.
__________: Iterates over the columns of each
row.

A

nested loops
traverse
Outer loop
nner loop

81
Q

Row-Major Order Traversal
Iterates over ______ before moving to
the next.

82
Q

___________
Iterates over each row before moving to
the next.

A

Row-Major Order Traversal

83
Q

__________
Iterates over each column before
moving to the next.

A

Column-Major Order Traversal

84
Q

Column-Major Order Traversal
Iterates over _____ before
moving to the next.

A

each column

85
Q

A data structure is a way of ________ and
______ so that it can be accessed and
modified efficiently.

A

organizing
storing data

86
Q

A data structure is a way of organizing and
storing data so that it can be_______ and
________ efficiently.

A

accessed
modified

87
Q

Some common data structures include ___,
linked lists, stacks, queues, hash tables, and
trees.

88
Q

Arrays in Java are homogeneous(consisting of
parts all of the same kind.) data structures
implemented in Java as ______.

89
Q

Arrays store one or
more values of a ________ and provide
_______ access to store the same.

A

specific data type
indexed

90
Q

Arrays offer a _____ means of grouping
related information.

A

convenient