Inheritance and Polymorphism
Sorting and Searching
Random Thoughts
Arrays and Array Lists
Miscellaneous
100

This many classes can extend another class. 

What is "as many as needed"?

100

This search involves looking at each value in order.

What is "Sequential search"?

100

This term is used to describe a "has-a" relationship.

What is "composition"?

100

Write code to find the number of rows in the array named list.

What is "list.length"?

100

What is the value of counter?

counter = 0;

for (int i = 10; i < 20; i+=2) {

  for (int j = 70; j < 100; j++){

    counter++;

}}

What is "5 * 30 or 150"?

200

The .toString() method is inherited from this class.

What is "the Object class"?

200

True or False?  There is only one way to code the binary search.

What is "false"?  There is an iterative approach and a recursive approach to the binary search.

200

This term is used to describe the "is a" relationship.

What is "inheritance"?

200

The .add(E obj) method has this job.

What is "This adds the object to the end of a list and returns true if the object is of the correct type"?

200

Of &&, <=, and +, give the operation that has precedence over the other 2.

What is "+"?

Then it is <= and then &&.

300

A method signature consists of this/these.

What is the "first line of the method"?

300

This sort takes a "divide and conquer" approach.

Mergesort

300
Evaluate:  10 - 5/10 + 60

What is "70"?

Note the integer division.

300

Give code to find the number of columns in row 3 (also index 3) in the 2D array named "students".

What is "students[3].length"?

300

This type of data can be equal to null.

What is "any object"?

400

Which class extends the other?

BirdBrain bob = new Bird();

What is "the Bird class extends the BirdBrain class"?

400

This sort traverses through the array and sorts the "part of the array it is looking at".  i.e. Once the sort is finished through index 5, all elements are sorted with respect to each other through index 5.

What is the "insertion sort"?

400

If a class extends another class, this is the first line of the constructor in the subclass.

What is "super()"?

400

Give one difference between an array and an ArrayList.

What is "ArrayLists are dynamic in size.  Arrays are static.  Or ArrayLists must hold object.  Arrays can also hold primitive data types.  OR ArrayLists should never have a "null" element.  Arrays might have a null element."

400

Tell whether the statement

"birds".compareTo("Birds")

returns a zero, a positive number, or a negative number.

What is "positive number"?

'b' has a larger ASCII value than 'B'.

500

Polymorphism is ...

What is "multiple classes extend the same class and so inherit from the same class"?

500

This is the maximum number of iterations a binary search runs if there are n pieces of data.

What is "log(n)"?

500

Give a line of code  to generate a random integer in the interval 40...55.

What is "(int)(Math.random() * 16) + 40"?

500

int[] arr = new int[400];

int sum = arr[0],       i=0; 

while(i< arr. length)

 { i++; 

sum+=arr[i]; } 

Give the result of executing this code segment.

What is "outOfBoundException"?

Note the i++ at the start of the loop.

500

When processing elements in an array, avoid throwing an exception by doing this.

What is "check to see that the element is not null first" or "use indices that do not go out of bounds"?

M
e
n
u