Title | |
---|---|
Which of these standard collection classes implements a dynamic arrayWhich of these standard collection classes implements a dynamic array?
The answer is:
C. ArrayList
|
|
Which of these class can generate an array which can increase and decrease in size automaticallyWhich of these class can generate an array which can increase and decrease in size automatically?
The answer is:
A. ArrayList()
|
|
Which of these method can be used to increase the capacity of ArrayList object manuallyWhich of these method can be used to increase the capacity of ArrayList object manually?
The answer is:
D. ensureCapacity
|
|
Which of these method of ArrayList class is used to obtain present size of an objectWhich of these method of ArrayList class is used to obtain present size of an object?
The answer is:
A. size()
|
|
Which of these methods can be used to obtain a static array from an ArrayList objectWhich of these methods can be used to obtain a static array from an ArrayList object?
The answer is:
C. toArray()
|
|
Which of these method is used to reduce the capacity of an ArrayList objectWhich of these method is used to reduce the capacity of an ArrayList object?
The answer is:
D. trimToSize()
|
|
What is the output of this programWhat is the output of this program
The answer is:
B. [A, D, B, C].
|
|
What is the output of this programWhat is the output of this program
The answer is:
C. 2
|
|
Map implements collection interface |
|
Which of the below does not implement Map interfaceWhich of the below does not implement Map interface?
The answer is:
D. Vector
|
|
What is the premise of equality for IdentityHashMapWhat is the premise of equality for IdentityHashMap?
The answer is:
A. Reference equality
|
|
What happens if we put a key object in a HashMap which existsWhat happens if we put a key object in a HashMap which exists?
The answer is:
A. The new object replaces the older object
|
|
While finding the correct location for saving key value pair, how many times the key is hashedWhile finding the correct location for saving key value pair, how many times the key is hashed?
The answer is:
B. 2
|
|
Is hashmap an ordered collection |
|
If two threads access the same hashmap at the same time, what would happenIf two threads access the same hashmap at the same time, what would happen?
The answer is:
A. ConcurrentModificationException
|
|
How to externally synchronize hashmapHow to externally synchronize hashmap?
The answer is:
C. Collections.synchronizedMap(new HashMap<String, String>());
|
|
What is the output of below snippetWhat is the output of below snippet?
The answer is:
A. {1=null, 2=null, 3=null, 4=null, 5=null}
|
|
If large number of items are stored in hash bucket, what happens to the internal structureIf large number of items are stored in hash bucket, what happens to the internal structure?
The answer is:
A. The bucket will switch from LinkedList to BalancedTree
|
|
How can we remove an object from ArrayListHow can we remove an object from ArrayList?
The answer is:
C. remove() method and using Iterator
|
|
How to remove duplicates from ListHow to remove duplicates from List?
The answer is:
A. HashSet<String> listToSet = new HashSet<String>(duplicateList);
|
MCQs
Views
Best Answers
Points