Chapter 6 (Arrays) Flashcards
In an array, the values can be different data types. True or False?
False
Usually, all the values in an array have _________ __ ______.
something in common
Each data item in an array is an…
element
These provide an organized storage and display system for a program’s data
an array
a series or list of values in a computer’s memory
array
each element in an array occupies an area in memory that is _________ to the others.
contiguous / adjacent
naming arrays follow the same rules as naming ________.
variables
an array name is not allowed to contain _________ ______.
embedded spaces
This differentiates elements in an array from each other
subscript/index
Subscripts cannot be _____ numbers.
real/floating
The position of a particular element within an array.
subscript / index
what is the most common symbol used to denote a subscript number?
brackets
Subscripts for an array always start at…
0
Assigning values to an array is called…
populating the array
the largest possible _______ in an array will always be arraySize - 1
subscript
[0]
sub zero
Can you declare and initialize array elements in one statement?
Yes
Can you assign new values to an array element?
Yes
Can you perform arithmetic with array elements?
Yes
Usable subscripts for an array range from 0 to one ____ than the number of elements in an array.
less
True or False: You cannot use a named constant as a subscript.
False
performing a search through a list from end to end
linear search
Flags: a variable that is set to indicate whether some _____ has occurred.
event
When using parallel arrays, they contain ________ _______ data.
logically related
When using parallel arrays, what computationally relates the arrays?
the subscripts
The relationship between any two or more elements of a parallel array is…
indirect (relationship)
comparing the value sought with the middle element in a sorted list. If the sought value is lower, you eliminate the second half of the list (or vice versa)
binary search
When using an array to store range limits, you use a ____ to make a series of comparisons that would otherwise require many separate decisions.
loop
When accessing data stored in an array using a subscript containing a value that accesses memory occupied by the array.
in bounds
With parallel arrays, each element in one array is associated with the element in the ____ _______ position in the other array.
same relative
Searching through an array to find a needed value involves 3 things, which are:
- INITIALIZING a subscript
- USING A LOOP TO TEST each array element.
- SETTING A FLAG when a match is found.
describes an array subscript that is not within the range of acceptable subscripts for its array.
out of bounds
An array element can be 3 things:
- named constant
- unnamed constant
- variable
Do parallel arrays have to be the same data type?
No
This is a particularly convenient tool when working with arrays because initializing, testing, and altering the control variable are coded together.
for loop
Elements of the same data type (such as in an array) always occupy the same number of _____ of _______
bytes, memory
The number of bytes in an array is always a multiple of the number of _______ in an array.
elements
If you declare a numeric array named numbers, and two of its elements are numbers[1] and numbers[4], how many elements are between them?
Two
If a list has numbers[4], you know that there at least ___ elements.
5
Each element in an array can only hold 1 value. True or False?
True
When using a subscript value that is out of bounds, the resulting action depends on the ____________ ________
programming language
In every array, a subscript is out of bounds when it is ________.
negative