Week 11 Part 2 Flashcards
o T/F – each element in an Array is the same data type.
True
o T/F – Each element in an array is differentiated by a subscript
True
o T/F – Each array element can be used in the same way as a single item of the same data type
True
o Arrays can be used to replace __ structures with several different user inputs
if
o It’s good practice to use _________ for array sizes
constants
o Why are constants good for array sizes?
Easier to change the array size later, removes magic numbers
o The most basic method of searching an array is
A linear search in a loop where the loop control variable also acts as the arrays index
- What is a Parallel Array?
An array that runs concurrent to another. One array for different pieces of data.
- Why should we not use Parallel Array in Java?
High maintenance, you need to keep the array indexes synchronized
o Solution to Parallel Array problem
Create a record object that an array can reference instead
customer Cust = new Customer(id, name, house);
Index[index] = customerId(index+1, name, house)
index [2] = customerId(index+1, name, house)
o A ___ loop is a natural way to sequentially access each element in an array. What is this process known as?
For, iterating over the array
What is an array in Java?
An object or reference type. It’s of reference regardless of whether the stored values are primitive.
Java can have elements of __________ type or _________
primitive, reference
o In java indexes are ____ or anything that can be promoted to an ___
Ints, int
o The lowest index value for an array is _
0