My Report

Java Collections Test – 1


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. Which of these packages contain all the collection classes?

2. Which of these methods deletes all the elements from invoking collection?

3. Which of this interface is not a part of Java's collection framework?

4. What is Collection in Java?

5. What will be the output of the following Java program?

 
    import java.util.*;
    class Array 
    {
        public static void main(String args[]) 
        {
            int array[] = new int [5];
            for (int i = 5; i > 0; i--)
                array[5-i] = i;
            Arrays.fill(array, 1, 4, 8);
            for (int i = 0; i < 5 ; i++)
                System.out.print(array[i]);
        }
    }

6. What will be the output of the following Java program?

 
    import java.util.*;
    class Bitset 
    {
        public static void main(String args[]) 
        {
            BitSet obj = new BitSet(5);
            for (int i = 0; i < 5; ++i)
                obj.set(i);
            obj.clear(2);
            System.out.print(obj);
        }
    }

7. Which of these classes is not part of Java's collection framework?


 

Start practicing “1000 MCQs on Java”, and once you are ready, you can take tests on all topics by attempting our “Java Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.