, To implement a Deque(double ended queue) with a firstNode and a lastNode reference,
which of the following underlying representations would result in a more efficient
implementation? - CORRECT ANSWERS-Double linked chain
Of the two sorting algorithms we studied in lecture, which would do less work, in terms
of comparisons and swaps, if executed upon an already sorted array? - CORRECT
ANSWERS-Insertion Sort
Advantage(s) of an inner iterator class over a separate iterator class: - CORRECT
ANSWERS-It has direct access to the ADT's data so it can execute more efficiently
For an array implementation of a list, the efficiency of remove(index) is: - CORRECT
ANSWERS-O(n)
For an array implementation of a stack, the efficient choice for the top is - CORRECT
ANSWERS-the last element in the array.
Which of the following List member methods should not be implemented for a
SortedList? - CORRECT ANSWERS-add(int newPosition, T newEntry)
Why do we use inheritance? - CORRECT ANSWERS-To have a general class with
common properties and behaviors shared by multiple more specialized classes.
A key benefit of inheritance is - CORRECT ANSWERS-an object can have several
types, it is type compatible with any of its superclasses
Encapsulation - CORRECT ANSWERS-A design principles that encloses data and
methods within a class', thereby hiding the class implementation details
abstraction - CORRECT ANSWERS-focus on what not how
client interface - CORRECT ANSWERS-what client code needs to know to use a class
implementation - CORRECT ANSWERS-all the data fields and details of method
defintions
The most efficient approach to dealing with a gap left in an array after removing an entry
from a bag is to - CORRECT ANSWERS-replace the entry being removed with the last
entry in the array and replace the last entry with null
Which of the following visibility modifiers should be used for a field in a class C if the
programmer does not want the the subclass to have direct access to the field? -
CORRECT ANSWERS-private
which of the following underlying representations would result in a more efficient
implementation? - CORRECT ANSWERS-Double linked chain
Of the two sorting algorithms we studied in lecture, which would do less work, in terms
of comparisons and swaps, if executed upon an already sorted array? - CORRECT
ANSWERS-Insertion Sort
Advantage(s) of an inner iterator class over a separate iterator class: - CORRECT
ANSWERS-It has direct access to the ADT's data so it can execute more efficiently
For an array implementation of a list, the efficiency of remove(index) is: - CORRECT
ANSWERS-O(n)
For an array implementation of a stack, the efficient choice for the top is - CORRECT
ANSWERS-the last element in the array.
Which of the following List member methods should not be implemented for a
SortedList? - CORRECT ANSWERS-add(int newPosition, T newEntry)
Why do we use inheritance? - CORRECT ANSWERS-To have a general class with
common properties and behaviors shared by multiple more specialized classes.
A key benefit of inheritance is - CORRECT ANSWERS-an object can have several
types, it is type compatible with any of its superclasses
Encapsulation - CORRECT ANSWERS-A design principles that encloses data and
methods within a class', thereby hiding the class implementation details
abstraction - CORRECT ANSWERS-focus on what not how
client interface - CORRECT ANSWERS-what client code needs to know to use a class
implementation - CORRECT ANSWERS-all the data fields and details of method
defintions
The most efficient approach to dealing with a gap left in an array after removing an entry
from a bag is to - CORRECT ANSWERS-replace the entry being removed with the last
entry in the array and replace the last entry with null
Which of the following visibility modifiers should be used for a field in a class C if the
programmer does not want the the subclass to have direct access to the field? -
CORRECT ANSWERS-private