| 21. |
Which of these methods is used to add elements in vector at specific location?
|
||||||||
|
Answer:
Option (d) |
| 22. |
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));
}
}
|
||||||||
|
Answer:
Option (c) |
| 23. |
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.capacity());
}
}
|
||||||||
|
Answer:
Option (c) |
| 24. |
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(6));
obj.insertElementAt(new Integer(8), 2);
System.out.println(obj);
}
}
|
||||||||
|
Answer:
Option (d) |
| 25. |
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));
obj.removeAll(obj);
System.out.println(obj.isEmpty());
}
}
|
||||||||
|
Answer:
Option (c) |
| 26. |
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);
}
}
|
||||||||
|
Answer:
Option (a) |
| 27. |
Which of these interface declares core method that all collections will have?
|
||||||||
|
Answer:
Option (d) |
| 28. |
Which of these interface handle sequences?
|
||||||||
|
Answer:
Option (b) |
| 29. |
Which of these is a basic interface that all other interface inherits?
|
||||||||
|
Answer:
Option (d) |
| 30. |
Which of these is static variable defined in Collections?
|
||||||||
|
Answer:
Option (d) |