Question 1 of 25
Hints left: 3
Q1
What is the unique feature of LinkedHashSet?
Q2
What will be the output of the following Java program? import java.util.*; class Collection_iterators { public static void main(String args[]) { ListIterator a = list.listIterator(); if(a.previousIndex()! = -1) while(a.hasNext()) System.out.print(a.next() + " "); else System.out.print("EMPTY"); } }
Q3
Which of these method of Array class is used sort an array or its subset?
Q4
Which of these is the interface of legacy is implemented by Hashtable and Dictionary classes?
Q5
What will be the output of the following Java code? import java.util.*; class stack { public static void main(String args[]) { Stack obj = new Stack(); obj.push(new Integer(3)); obj.push(new Integer(2)); obj.pop(); obj.push(new Integer(5)); System.out.println(obj); } }
Q6
Which of these method is used to remove all keys/values pair from the invoking map?
Q7
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()); } }
Q8
How to externally synchronize hashmap?
Q9
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); } }
Q10
What happens if we put a key object in a HashMap which exists?
Q11
If two threads access the same hashmap at the same time, what would happen?
Q12
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.sort(array); for (int i = 0; i < 5; ++i) System.out.print(array[i]);; } }
Q13
Which of these class object can be used to form a dynamic array?
Q14
Which of these method is used to insert value and its key?
Q15
What will be the output of the following Java program? import java.lang.reflect.*; class Additional_packages { public static void main(String args[]) { try { Class c = Class.forName("java.awt.Dimension"); Method methods[] = c.getMethods(); for (int i = 0; i < methods.length; i++) System.out.println(methods[i]); } catch (Exception e) { System.out.print("Exception"); } } }
Q16
What will be the output of the following Java code? import java.util.*; class vector { public static void main(String args[]) { Vector obj = new Vector(4,2); obj.addElement(new Integer(3)); obj.addElement(new Integer(2)); obj.addElement(new Integer(5)); System.out.println(obj.elementAt(1)); } }
Q17
Set has contains(Object o) method.
Q18
Which of these class is used for creating a client for a server-client operations?
Q19
Which of these methods can randomize all elements in a list?
Q20
Which of these methods can be used to obtain a static array from an ArrayList object?
Q21
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); while(i.hasNext()) System.out.print(i.next() + " "); } }
Q22
Which of these package is used for remote method invocation?
Q23
Which of these class object uses the key to store value?
Q24
What will be the output of the following Java program? import java.util.*; class Arraylist { public static void main(String args[]) { ArrayList obj1 = new ArrayList(); ArrayList obj2 = new ArrayList(); obj1.add("A"); obj1.add("B"); obj2.add("A"); obj2.add(1, "B"); System.out.println(obj1.equals(obj2)); } }
Q25
Which of these interface handle sequences?