Collections
- Which of these method is used to remove all keys/values pair from the invoking map?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
remove()
- Which of these classes provide implementation of map interface?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
AbstractMap, WeakHashMap, HashMap and TreeMap provide implementation of map interface.
- What is the output of this program?
import java.util.*;
public class Linkedlist_Example
{
public static void main(String args[])
{
LinkedList object = new LinkedList();
object.add("I");
object.add("L");
object.add("U");
object.removeFirst();
System.out.println(object);
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
[L, U]
- Which of this method is used to change an element in a LinkedList Object?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
An element in a LinkedList object can be changed by first using get() to obtain the index or location of that object and the passing that location to method set() along with its new value.
- What is the output of this program?
import java.util.*;
public class Linkedlist_Example
{
public static void main(String args[])
{
LinkedList object = new LinkedList();
object.add("O");
object.add("V");
object.add("E");
object.addFirst("L");
System.out.println(object);
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
object.addFirst(“L”) method is used to add ‘L’ to the start of a LinkedList object obj.