Question 1 of 25
Hints left: 3
Q1
Which of these method can be used to increase the capacity of ArrayList object manually?
Q2
What is the difference between Queue and Stack?
Q3
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); } }
Q4
What is the purpose of the `Collections.reverse()` method in the Java Collections Framework?
Q5
What are the use of front and rear pointers in CircularQueue implementation?
Q6
Which of these method Map class is used to obtain an element in the map having specified key?
Q7
Which of these methods can convert an object into a List?
Q8
What is the name of a data member of class Vector which is used to store a number of elements in the vector?
Q9
Which of these methods can be used to obtain set of all keys in a map?
Q10
Which of these is static variable defined in Collections?
Q11
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() + " "); } }
Q12
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()); } }
Q13
What is the primary difference between a `HashSet` and a `LinkedHashSet` in the Java Collections Framework?
Q14
What is Collection in Java?
Q15
Which of these methods is used to add elements in vector at specific location?
Q16
Which of these method is used to reduce the capacity of an ArrayList object?
Q17
Which of these methods are member of Remote class?
Q18
Which of the below is not a subinterface of Queue?
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.get("B")); } }
Q20
What is the premise of equality for IdentityHashMap?
Q21
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); } }
Q22
Which of these packages contain all the collection classes?
Q23
In Java, which method is used to obtain a synchronized (thread-safe) map from an existing map in the Java Collections Framework?
Q24
How to sort elements of ArrayList?
Q25
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