Array Flashcards

(90 cards)

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
Elements are stored column by column in memory
Column-Major Order
26
_______ are stored in contiguous memory locations.
Arrays
27
Arrays are stored in _________________.
contiguous memory locations
28
Elements are accessed using ____________.
numeric indexing
29
A ____________ 2D array stores elements of different data types.
heterogeneous
30
Gives the number of rows in the 2D array.
numbers.length
31
Iterates over each row before moving to the next.
Row-Major Order Traversal
32
Iterates over each column before moving to the next.
Column-Major Order Traversal
33
2D array is an array of _____.
arrays
34
It stores data in ____ and ____ (tabular format).
rows columns
35
It stores data in rows and column (_____).
tabular format
36
Elements are accessed using two indices.______ and ______
Row index and column index
38
What is columns
Vertical Elements
39
______ are accessed using two indices
Elements
40
2D is also called__________ because they use more than one dimensions.
Multidimensional arrays
41
2D is commonly used in programming to ______ and______ data.
Store Manipulate
42
What is rows?
Horizontal elements
42
Java treats a 2D array as a _______ of 1D arrays.
collection
43
Each row in a 2D array is _____ to 1D array.
Pointer
44
Syntax for declaring 2D array:
Two square brackets
45
Specify the number of rows but leave columns uninitialized.
Double-Dimensional array with only rows initialized.
46
Creates a _________(rows can have different column sizes).
Jagged array
47
Arrays are stored in __________.
contagious memory locations.
48
Elements are accessed 1using _______
numeric indexing
49
____________ in Java are like the basic units or building blocks of a Java program.
Methods
50
A method is a ___________ that performs a specific task or operation.
group of code
51
A method is a group of code that performs a ____________.
specific task or operation
52
a method is a collection of __________ that work together to complete a particular job.
statements
53
Applications of 2D Arrays: Used in mathematics to represent __________ and ________.
matrices complex data structures
54
____________ Can store: ______ ________ Other types of data.
Images. Text.
55
Applications of 2D Arrays: Useful for __________ and ___________.
data analysis visualization
56
Java treats a __________ as a collection of 1D arrays.
2D array
57
Java treats a 2D array as a collection of ___________.
1D arrays
58
A 2D array in Java has rows and columns, requiring ______ indices: One for the _______. One for the _______.
two row column
59
Syntax for declaring a 2D array ________: Type of values the array can store (e.g., int, char).
DataType
60
Syntax for declaring a 2D array ________: Reference variable for the 2D array object.
ArrayName
61
Ways to Initialize a 2D Array ______________: Assign values directly during declaration.
Static Initialization
62
Ways to Initialize a 2D Array ____________: Set the size first, then assign values later.
Dynamic Initialization
63
Types of 2D Array Initialization 1. Double-Dimensional Array with Only Rows Initialized Specify the number of rows but leave columns __________.
uninitialized
64
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).
jagged array flexible structures
65
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.
Double-Dimensional Array with Only Columns Initialized
66
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
Double-Dimensional Array with Only Rows Initialized
67
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.
Double-Dimensional Array with No Rows or Columns Initialized reference
68
A ________ is a 2D array where each row can have a different number of columns
jagged array
69
A jagged array is a 2D array where each row can have a different number of ___________
columns
70
Unlike regular 2D arrays, jagged arrays are not ____________. Useful when the data structure is __________ (e.g., varying number of subjects per student).
rectangular irregular
71
Declaring and Initializing a Heterogeneous 2D Array A heterogeneous 2D array stores ___________ of __________.
elements different data types
72
Declaring and Initializing a Heterogeneous 2D Array A ___________ stores elements of different data types.
heterogeneous 2D array
73
Java arrays are _______ by ______all elements must be of the same type).
homogeneous default (
74
To achieve __________, we use a workaround involving the Object class
heterogeneity
75
To achieve heterogeneity, we use a workaround involving the _____
Object class
76
To achieve heterogeneity, we use a ______ involving the Object class.
workaround
77
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.
Object class hierarchy elements
78
Declaring and Initializing a Heterogeneous 2D Array Declare the array as _______ Assign ______ of different types
Object[][] values
79
Accessing 2d Array Elements Since the array is of type Object, you must _________ elements back to their original types when _____ them
cast(typecasting) accessing
80
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.
nested loops traverse Outer loop nner loop
81
Row-Major Order Traversal Iterates over ______ before moving to the next.
each row
82
___________ Iterates over each row before moving to the next.
Row-Major Order Traversal
83
__________ Iterates over each column before moving to the next.
Column-Major Order Traversal
84
Column-Major Order Traversal Iterates over _____ before moving to the next.
each column
85
A data structure is a way of ________ and ______ so that it can be accessed and modified efficiently.
organizing storing data
86
A data structure is a way of organizing and storing data so that it can be_______ and ________ efficiently.
accessed modified
87
Some common data structures include ___, linked lists, stacks, queues, hash tables, and trees.
arrays
88
Arrays in Java are homogeneous(consisting of parts all of the same kind.) data structures implemented in Java as ______.
objects
89
Arrays store one or more values of a ________ and provide _______ access to store the same.
specific data type indexed
90
Arrays offer a _____ means of grouping related information.
convenient