General Info
Declare & Search
Passing Values
Parallel & 2D
leftovers
100
An array is a data structure that consists of
A contiguous block of memory cells
100
When declaring an array with a value list, the values are delimited by what character?
{ curly bracket for example: int num[ ] {1, 8, 7, 10, 4};
100
How do you pass the first element of an array numArr into a method called Sum, as an actual argument?
Sum (numArr[0]);
100
What is true of parallel arrays and their size?
Parallel arrays must be the same size.
100
A multidimensional array is essentially an array of
arrays
200
Array elements are identified by
Its index value
200
The value list does what in addition to loading values in the array?
Initialize the array at a certain size.
200
If the actual argument is an integer array (the entire array) how do you set up the formal parameter when you define the method?
private: void (int num[ ])
200
What is true of the index (or subscript) values of corresponding elements of parallel arrays?
They must have the same subscript values
200
When navigating through a 2d array with nested loops, the outer loop selects the ___ and the inner loop selects the ___
Outer: row Inner: column
300
Individual data containers in an array are called
Elements
300
How are each of the value in an array accessed?
Use the loop control variable of the for loop
300
How do you pass an entire array called numArr into a method called CalculateMean?
CalculateMean(numArr);
300
Rows and columns of a table are a visual representation of what type of array structure?
Two dimensional arrays.
300
An array element index value is also called ____
A subscript
400
An array declared as arr[9] has index values of
0-8
400
A sequential search continues until one of what two things happens?
The target is found or it runs out of places to look (end of array)
400
A sequential search looks for a target value in an array in what fashion?
One index at a time, in order through the array.
400
The cell in the upper left corner of a 2d array has what index values?
Num [0] [0]
400
In a sequential search of an array of 5 elements, a total of how many comparisons are made if the target value is NOT found?
5, the size of the array. (see page 340)
500
What is the main advantage of an array?
Storing large amounts of data
500
Navigating through 2d arrays requires what programming structure?
Nested loops
500
When does a for loop executing a sequential search use a break statement?
When the target is found.
500
If an array is declared int item[8]; why is item[8] illegal?
Because the elements are numbered 0-7, item[8] is out of range.
500
In a sequential search of an array of 5 elements, a total of how many comparisons are made if the target value IS found?
i + 1 (if found at location 3, 4 comparisons were made) (see page 340)