Declaring arrays
What are arrays?
Max/Min/
Average
Array Sorting
Search Algorithms
100

Do the indexes count from 1?

No, it counts from 0 to n-1.

100

Does using arrays instead of lots of variables save memory space?

Yes

100

What type of loop is best used when finding max, min and average in an array?

for loop

100

What is the call statement for the Array Sorting method found within the java.util.Arrays class?

Array.sort(<data type>[] <array name>);

Array.sort(int[] arr);

100

What is another name for binary search

Logarithmic Search

200

Can you change the length/size after when it is set?

No, once the size is set it can not be resized anymore. 

200

What happens if you try to access an index that doesn’t exist?

AOB error

200

The 'current max' is replaced by the value from the array when the current max is greater than or less than the value from the array?

less than

200

What sorting technique does the following image depict?

                 

Bubble Sort

200

Which type of algorithmic search usually requires a for loop?

Sequential Search (linear)

300

what is the general syntax

type [] arrayName = new type[length];
300

Are Java arrays homogeneous or heterogeneous data structures?

Homogenous data structures (data is the same type)

300

When finding the average in an array which variable needs to be initialized?

sum

300

Why is sorting arrays important?

It makes the data stored in arrays more usable by improving the efficiency of processes like searching.

300

In a binary search, how is the middle index found?

(first index + last index) / 2

400

What are the 3 things we need to know for declaring an array?

1. the data type that is storing in the array

2. the name of the array

3. the length/size of the array

400

Briefly describe what 3D arrays can be visualized like.

A cube with rows, columns, and depth, or a series of spreadsheets laid together

400

When finding the average of an array in the for loop

for(int j=0;j< x ;j++);{

What is x?

length of the array

400

How many comparisons will it take to sort the following unsorted array?

{62,2,8,97,24,7,2,10}

28
400

In a binary search, what will happen when the key is smaller than the middle index?

last index = middle index - 1

500

What are the two ways to initialize the elements?

1. using a for loop 

2. arrayName[index] = value;

500

Briefly describe two uses of arrays with methods that were covered.

1. Create, initialize and return a new array

2. Pass an existing array as a parameter and manipulate its values

500

How does the loop help to find the min in an array?

The loop goes through every value in the array and by using an if statement it compares the value to the 'current min' 

500

What is wrong with the following bubbleSort method?

 

Since j is initialized at 1 and not 0, the function will not sort the first element of the array.

500

What statement keeps the program in the while loop in a binary search

first index <= last index