Vidyalelo
Java Programming · all questions

Java Collections Framework
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

179

Questions

4/9

Page

Pick an option on a question to see the right answer and solution.

What is the remaining capacity of BlockingQueue whose intrinsic capacity is not defined?

Select an option to see the answer and solution.

What will be the output of the following Java code snippet?
public class Test 
{
	public static void main(String[] args) 
        {
		Set s = new HashSet();
		s.add(new Long(10));
		s.add(new Integer(10));
		for(Object object : s)
                {
		    System.out.println("test - "+object);
		}
	}
}

Select an option to see the answer and solution.

Where does a new element be inserted in linked list implementation of a queue?

Select an option to see the answer and solution.

Which class provides thread safe implementation of List?

Select an option to see the answer and solution.

Which of these is the interface of legacy?

Select an option to see the answer and solution.

While finding the correct location for saving key value pair, how many times the key is hashed?

Select an option to see the answer and solution.

Which of these package is used for all the text related modifications?

Select an option to see the answer and solution.

Which of these is a Basic interface that all other interface inherits?

Select an option to see the answer and solution.

What will be the output of the following Java code?
import java.util.*;
class hashtable 
{
    public static void main(String args[]) 
    {
        Hashtable obj = new Hashtable();
        obj.put("A", new Integer(3));
        obj.put("B", new Integer(2));
        obj.put("C", new Integer(8));
        System.out.print(obj.contains(new Integer(5)));
    }
}

Select an option to see the answer and solution.

Which of the below is not an implementation of List interface?

Select an option to see the answer and solution.

Which of these is a method of ListIterator used to obtain index of previous element?

Select an option to see the answer and solution.

What will be the output of the following Java program?
import java.util.*;
class Arraylist 
{
    public static void main(String args[]) 
    {
        ArrayList obj = new ArrayList();
        obj.add("A");
        obj.add("B");
        obj.add("C");
        obj.add(1, "D");
        System.out.println(obj);
    }
}

Select an option to see the answer and solution.

What will be the output of the following Java program?
import java.util.*;
class Maps 
{
    public static void main(String args[]) 
    {
        TreeMap obj = new TreeMap();
        obj.put("A", new Integer(1));
        obj.put("B", new Integer(2));
        obj.put("C", new Integer(3));
        System.out.println(obj.entrySet());
    }
}

Select an option to see the answer and solution.

Which of these method is used to calculate number of bits required to hold the BitSet object?

Select an option to see the answer and solution.

Which of these Exceptions is thrown by remote method?

Select an option to see the answer and solution.

When an array is passed to a method, will the content of the array undergo changes with the actions carried within the function?

Select an option to see the answer and solution.

Which of these class object has an architecture similar to that of array?

Select an option to see the answer and solution.

Which of these method of Array class is used sort an array or its subset?

Select an option to see the answer and solution.

What will be the output of the following Java code?
import java.util.*;
class hashtable 
{
    public static void main(String args[]) 
    {
        Hashtable obj = new Hashtable();
        obj.put("A", new Integer(3));
        obj.put("B", new Integer(2));
        obj.put("C", new Integer(8));
        System.out.print(obj.toString());
    }
}

Select an option to see the answer and solution.

Which of these is the interface of legacy is implemented by Hashtable and Dictionary classes?

Select an option to see the answer and solution.