Collections
- If large number of items are stored in hash bucket, what happens to the internal structure?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
BalancedTree will improve performance from O(n) to O(log n) by reducing hash collisions.
- Which of these standard collection classes implements a linked list data structure?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
LinkedList
- What is the output of below snippet?
import java.util.*;
public class Map_Example
{
public static void main(String[] args)
{
MapmapSample = new TreeMap ();
mapSample.put(4, null);
mapSample.put(0, null);
mapSample.put(3, null);
mapSample.put(2, null);
mapSample.put(1, null);
System.out.println(mapSample);
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
HashMap needs unique keys. TreeMap sorts the keys while storing objects.
- Which of these method is used to add an element to the start of a LinkedList object?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
addFirst()
- Which of these method of HashSet class is used to add elements to its object?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
add()