Question 1 of 25
Hints left: 3
Q1
Which of these method Map class is used to obtain an element in the map having specified key?
Q2
Which of these packages contain all the collection classes?
Q3
Which of these method is used to reduce the capacity of an ArrayList object?
Q4
Which of these methods can be used to obtain set of all keys in a map?
Q5
What is the premise of equality for IdentityHashMap?
Q6
Which of the below is not a subinterface of Queue?
Q7
Which of these methods can convert an object into a List?
Q8
What is the purpose of the `Collections.reverse()` method in the Java Collections Framework?
Q9
What will be the output of the following Java program? import java.util.*; class Collection_Algos { public static void main(String args[]) { LinkedList list = new LinkedList(); list.add(new Integer(2)); list.add(new Integer(8)); list.add(new Integer(5)); list.add(new Integer(1)); Iterator i = list.iterator(); Collections.reverse(list); Collections.sort(list); while(i.hasNext()) System.out.print(i.next() + " "); } }
Q10
What is the difference between Queue and Stack?
Q11
What are the use of front and rear pointers in CircularQueue implementation?
Q12
Which of these methods is used to add elements in vector at specific location?
Q13
What is Collection in Java?
Q14
What is the primary difference between a `HashSet` and a `LinkedHashSet` in the Java Collections Framework?
Q15
Which of these is static variable defined in Collections?
Q16
In Java, which method is used to obtain a synchronized (thread-safe) map from an existing map in the Java Collections Framework?
Q17
How to sort elements of ArrayList?
Q18
Which of these methods are member of Remote class?
Q19
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()); } }
Q20
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); } }
Q21
Which of these method can be used to increase the capacity of ArrayList object manually?
Q22
What will be the output of the following Java code snippet? import java.util.*; class Linkedlist { public static void main(String args[]) { LinkedList obj = new LinkedList(); obj.add("A"); obj.add("B"); obj.add("C"); obj.addFirst("D"); System.out.println(obj); } }
-
A
-
B
-
C
-
D
Q23
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.get("B")); } }
Q24
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); } }
Q25
What is the name of a data member of class Vector which is used to store a number of elements in the vector?