Question: 1) Collections method sort that accepts a List as an argument sorts the elements of a List, which must implement the __________ interface. Comparable. Comparator.
1) Collections method sort that accepts a List as an argument sorts the elements of a List, which must implement the __________ interface.
| Comparable. |
| Comparator. |
| Compare. |
| Ordering. |
2) Comparator method compare should return ________ if the first argument is greater than the second argument.
| a positive int value. |
| zero. |
| a negative int value. |
| a String. |
|
|
3) Which statement is false?
| -Java does not guarantee which item will be found first when a binarySearch is performed on a List containing multiple elements equivalent to the search key. |
| - | If the search key is found, method binarySearch returns the List index (position relative to 1) of the element containing the search key. |
| -The binary search algorithm is fast. |
| - | Method binarySearch takes a List as the first argument. |
4) Collections method __________ returns true if two Collections have no elements in common.
| shuffle. |
| contains. |
| hasCommon. |
| disjoint. |
|
|
5) Which statement is false?
| Queue is a new collection interface introduced in J2SE 5.0. |
| Queue and PriorityQueue are included in the java.util package. |
| PriorityQueue orders elements in increasing order, so that smallest value will be the first element removed from PriorityQueue. |
| Queue extends interface Collection. |
6) Which statement about hashing is false?
| Hashing facilitates high-speed storing and retrieval of data. |
| Two different data items can hash to the same cell; this is called a collision. |
| A load factor of 0.5 usually results in good hashing performance, but less efficient utilization of memory. |
| A load factor of 1.0 usually results in good hashing performance, but less efficient utilization of memory.
7) Map method ________ is used to determine whether a map contains a mapping for the specified key.
8) A ________ is a column (or set of columns) which have a unique value that cannot be duplicated in other rows?
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
