Inheritance and Polymorphism
Sorting and Searching
Program Design
Arrays and Array Lists
Miscellaneous
100
How many interfaces can a class implement?
A class can implement many interfaces.
100
Which search involves looking at each value in order?
Sequential search
100
What term is used to describe a "has-a" relationship?
Composition
100
What method is used to access the length of an array list?
list.size()
100
Each digit in hexadecimal can be written in how many digits in binary?
4 digits
200
Can an interface implement another interface?
No, interfaces extend interfaces.
200
Which type of search uses a pivot value?
Quicksort
200
What is top down development?
This is when you implement the main classes first and sub classes later.
200
What does the boolean add(E obj) method do?
This adds the object to the end of a list and returns true if the object is of the correct type.
200
How many reserved words are in java?
50
300
What is a method's signature?
The signature of a method is the name of the method and the data types of its parameters.
300
Which sort takes a "divide and conquer" approach?
Mergesort
300
If you divide by 0 in a code, what error will be thrown?
A run-time error
300
When accessing the length of an array, why are no parameters needed?
The length of an array is considered to be a field.
300
Which types of data can you set equal to null?
Any object
400
Birthday happy; happy = new AdultBirthday( "Joe", 39); happy.greeting(); Which greeting() method is run: the one defined for Birthday or the one defined for AdultBirthday?
The one defined for AdultBirthday because that is the type of the object referred to by happy.
400
Which sort involves taking the largest data value and moving it to the end of the list?
Selection sort
400
What is a UML diagram?
This is a tree-like representation of the relationship between classes.
400
What are 2 differences between an array and array list?
ArrayLists are resizable, can only accept objects (not primitives), and use the .size() method instead of .length.
400
When comparing letters lexicographically, are capital letters greater or less than lowercase ones?
Capitals are less then lowercase letters.
500
What is the name of the error that occurs when attempt is made to cast an object to a class of which it is not an instance?
ClassCastException
500
If there are N data values in a list, for how many iterations will a binary search run?
logN
500
What is a stub method?
A dummy method called by another method being tested
500
int sum = arr[0], i=0; while(i< arr. length) { i++; sum+=arr[i]; } What will be the result of executing this code segment?
A run time error will occur.
500
What is the largest value that can be stored as an int?
2^31 -1
M
e
n
u