Arrays Flashcards

1
Q

________ store values, but typically only ________ at a time.

A

Variables, one value

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

_____ allow you to ______ a variable _______ efficiently.

A

Loops, reuse, multiple times

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

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

A

data structure, accessed, modified

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

What are the common Data structures? (name 6 common structures)

A

arrays, linked lists, stacks, queues, hash tables, trees

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

______ in Java are _______(consisting of parts all of the same kind.)

A

Arrays, homogeneous

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

Arrays store ________ values of a specific _______ and provide _________ to store the same.

A

one or more, data type, indexed access

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

A specific ________ in an array is accessed by its ______.

A

element, index

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

______ offer a convenient means of ________
related information.

A

Arrays, grouping

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

An ______ in an array is a ______ value stored at a
particular position. Each element shares the same
_______ as the array.

A

element, single, data type

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

What is the plural form of index?

A

Indices

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

What is an index?

A

An index is the position of an element inside an array.

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

A _________ is the _______ address in computer memory (RAM) where an array stores its ________.

A

memory location, physical, elements

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

What happens when an array is created?

A

Java allocates a continuous block of memory to store its values.

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

Arrays in Java are ______ types, meaning the variable holds a ________ (not actual values).

A

reference, memory address

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

The _______ is the total ______ of elements stored in an array. In Java, we use .length to get the size of the array.

A

array length, number

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

What are the parts of array?(refer to the anatomy of an array)

A

name of the array list, indexes, array objects with index positions, value of the list, address of the list, memory address

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

What are the 3 main types of Arrays?

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
18
Q

This array contains one or more arrays, allowing you to store data in a structured, tabular, or grid-like format, like a table with rows and columns

A

Multi-Dimensional Arrays

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

This Array is a ____ dimensional 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
20
Q

This is an Array where you can imagine a ____ Dimensional Arrays 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
21
Q

What is the first step you will do in declaration and initialization?

A

you must declare a variable of the desired array type

22
Q

What is the second step you will do in declaration and initialization?

A

you must allocate the memory that will hold the array, using new, and assign it to the array variable.

23
Q

Identify the parts(the ones inside the parenthesis) of this syntax: (int) a = new int ([5]);

A

data type, size of array

24
Q

Each element is initialized to a _______, a process known as _________.

A

default value, auto-initialization

25
A ________ array (1D array) in Java is a structured way of ______________ of the same data type under a single variable name.
one-dimensional, storing multiple values
26
Since an ______ is an ________ structure, the 1st element of the array is stored at the ____ index, 2nd element is stored on __ index, and so on.
array, index-based, 0th, 1st
27
How to access 1D array element?
We can access a specific element by its index within the square bracket
28
It is the way of processing each array element sequentially from the first to the last.
Array Traversal
29
Since arrays have a ______, they often require _____ to efficiently _____, ______, and process their elements.
fixed size, loops, access, modify
30
Which loop is commonly used when working with arrays?
For-loop
31
The ______ is used to iterate through an array, allowing us to access each _____one by one without _____ writing separate statements for each index.
for loop, element , manually
32
Why do we use for loop with array?
Efficient Iteration, Handles Arrays of Any Size, Easy Access to Indexes, Useful for Common Operations
33
What is the other name for enhanced for loop?
for-each loop
34
This eliminates the need for index tracking, making the code cleaner and easier to read.
enhanced for loop or for-each loop
35
What are the 2 limitations of for-each loop?
1.Cannot Modify Array Elements and 2.Cannot Access Index Directly
36
what are the 5 pitfalls of arrays?
1.Array Index Out of Bounds Exception (ArrayIndexOutOfBoundsException) 2.Fixed Size Limitation 3.Forgetting to Initialize an Array 4. Incorrect Use of .length 5. Forgetting That Arrays in Java Are Zero-Indexed
37
Identify what type of pitfall is this: What is the error that occurs when .length is used incorrectly in loops?
Incorrect Use of .length
38
Identify what type of pitfall is this: What error occurs when an array is declared but not initialized?
Forgetting to Initialize an Array
39
Identify what type of pitfall is this: What is a common mistake beginners make regarding Java array indexing?
Forgetting That Arrays in Java Are Zero-Indexed
40
Identify what type of pitfall is this: What exception occurs when trying to access an index outside the valid range of an array in Java?
Array Index Out of Bounds Exception (ArrayIndexOutOfBoundsException)
41
Identify what type of pitfall is this: What is a limitation of arrays in Java regarding their size?
Fixed Size Limitation
42
Java provides various utility methods to work with arrays through the _______ in the_______.
Arrays class, java.util package
43
The ____ class is a utility class that provides _________ to perform common array ________.
Arrays, static methods, operations
44
It simplifies tasks such as _______, ________, _______, and ________ without requiring manual implementation.
sorting, comparing, filling, copying arrays
45
This array method sorts arrays in ascending order.
Arrays.sort()
46
This array method checks if two arrays contain the same elements in the same order.
Arrays.equals()
47
This array method sets all elements in an array to a specific value.
Arrays.fill()
48
This array method creates a new array with the same elements as the original.
Arrays.copyOf()
49
This array method converts an array into a formatted String representation.
Arrays.toString()
50
This array method is used to search for an element in a sorted array efficiently.
Arrays.binarySearch()
51
This array method is used to convert a String into a character array (char[]).
toCharArray()