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

3/9

Page

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

What will be the output of the following Java code?
import java.util.*;
class Bitset
{
    public static void main(String args[])
    {
        BitSet obj1 = new BitSet(5);
        BitSet obj2 = new BitSet(10);
        for (int i = 0; i < 5; ++i)
            obj1.set(i);
        for (int i = 3; i < 13; ++i)
            obj2.set(i);
        obj1.and(obj2);
        System.out.print(obj1);
    }
}

Select an option to see the answer and solution.

What are the use of front and rear pointers in CircularQueue implementation?

Select an option to see the answer and solution.

Which of the below is not a subinterface of Queue?

Select an option to see the answer and solution.

Which of these method is used to reduce the capacity of an ArrayList object?

Select an option to see the answer and solution.

How to sort elements of ArrayList?

Select an option to see the answer and solution.

Which of these packages contain all the collection classes?

Select an option to see the answer and solution.

Which of these methods can be used to obtain set of all keys in a map?

Select an option to see the answer and solution.

Which of these methods are member of Remote class?

Select an option to see the answer and solution.

Which of these method Map class is used to obtain an element in the map having specified key?

Select an option to see the answer and solution.

What is the name of a data member of class Vector which is used to store a number of elements in the vector?

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[]) 
    {
        HashMap obj = new HashMap();
        obj.put("A", new Integer(1));
        obj.put("B", new Integer(2));
        obj.put("C", new Integer(3));
        System.out.println(obj.keySet());
    }
}

Select an option to see the answer and solution.

What will be the output of the following Java code?
import java.util.*;
class date
{
    public static void main(String args[])
    {
        Date obj = new Date();
        System.out.print(obj);
    }
}

Select an option to see the answer and solution.

What is the worst case complexity of accessing an element in ArrayList?

Select an option to see the answer and solution.

What is the length of the application box made in the following Java program?
import java.awt.*;
import java.applet.*;
public class myapplet extends Applet 
{
    Graphic g;
    g.drawString("A Simple Applet",20,20);    
}

Select an option to see the answer and solution.

If large number of items are stored in hash bucket, what happens to the internal structure?

Select an option to see the answer and solution.

Which of these standard collection classes implements a dynamic array?

Select an option to see the answer and solution.

What is the default clone of HashSet?

Select an option to see the answer and solution.

What is the correct method used to insert and delete items from the queue?

Select an option to see the answer and solution.

Which of these standard collection classes implements all the standard functions on list data structure?

Select an option to see the answer and solution.

What happens if two threads simultaneously modify TreeSet?

Select an option to see the answer and solution.