91. Which of these methods can randomize all elements in a list?
92. If two threads access the same hashmap at the same time, what would happen?
93. Which of these methods can be used to obtain a static array from an ArrayList object?
94. Which of these method is used to insert value and its key?
95. Which of these method is used to remove all keys/values pair from the invoking map?
96. What will be the output of the following Java program?
import java.util.*;
class Collection_iterators
{
public static void main(String args[])
{
ListIterator a = list.listIterator();
if(a.previousIndex()! = -1)
while(a.hasNext())
System.out.print(a.next() + " ");
else
System.out.print("EMPTY");
}
}
import java.util.*;
class Collection_iterators
{
public static void main(String args[])
{
ListIterator a = list.listIterator();
if(a.previousIndex()! = -1)
while(a.hasNext())
System.out.print(a.next() + " ");
else
System.out.print("EMPTY");
}
}
97. What will be the output of the following Java program?
import java.lang.reflect.*;
class Additional_packages
{
public static void main(String args[])
{
try
{
Class c = Class.forName("java.awt.Dimension");
Method methods[] = c.getMethods();
for (int i = 0; i < methods.length; i++)
System.out.println(methods[i]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}
import java.lang.reflect.*;
class Additional_packages
{
public static void main(String args[])
{
try
{
Class c = Class.forName("java.awt.Dimension");
Method methods[] = c.getMethods();
for (int i = 0; i < methods.length; i++)
System.out.println(methods[i]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}
98. What happens if we put a key object in a HashMap which exists?
99. Which of these interface handle sequences?
100. How to externally synchronize hashmap?
Read More Section(Collections Framework in java)
Each Section contains maximum 100 MCQs question on Collections Framework in java. To get more questions visit other sections.