| 1. |
Which of these standard collection classes implements a dynamic array?
|
||||||||
|
Answer:
Option (c) |
| 2. |
Which of these class can generate an array which can increase and decrease in size automatically?
|
||||||||
|
Answer:
Option (a) |
| 3. |
Which of these method can be used to increase the capacity of ArrayList object manually?
|
||||||||
|
Answer:
Option (d) |
| 4. |
Which of these method of ArrayList class is used to obtain present size of an object?
|
||||||||
|
Answer:
Option (a) |
| 5. |
Which of these methods can be used to obtain a static array from an ArrayList object?
|
||||||||
|
Answer:
Option (c) |
| 6. |
Which of these method is used to reduce the capacity of an ArrayList object?
|
||||||||
|
Answer:
Option (d) |
| 7. |
What will be the output of the following Java program?
import java.util.*;
class Arraylist
{
public static void main(String args[])
{
ArrayList obj = new ArrayList();
obj.add("A");
obj.add("B");
obj.add("C");
obj.add(1, "D");
System.out.println(obj);
}
}
|
||||||||
|
Answer:
Option (b) |
| 8. |
What will be the output of the following Java program?
import java.util.*;
class Output
{
public static void main(String args[])
{
ArrayList obj = new ArrayList();
obj.add("A");
obj.add(0, "B");
System.out.println(obj.size());
}
}
|
||||||||
|
Answer:
Option (c) |
| 9. |
What will be the output of the following Java program?
import java.util.*;
class Output
{
public static void main(String args[])
{
ArrayList obj = new ArrayList();
obj.add("A");
obj.ensureCapacity(3);
System.out.println(obj.size());
}
}
|
||||||||
|
Answer:
Option (a) |
| 10. |
What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
ArrayList obj = new ArrayList();
obj.add("A");
obj.add("D");
obj.ensureCapacity(3);
obj.trimToSize();
System.out.println(obj.size());
}
}
|
||||||||
|
Answer:
Option (b) |