Which of the following classes does NOT implement the List interface?
What is the default initial capacity of an ArrayList when created with a no-arg constructor?
What will be the output of the following code?
Java
import java.util.*;
public class Test {
public static void main(String[] args) {
List<Integer> list = new ArrayList<>();
list.add(1); list.add(2); list.add(3);
list.add(1, 10);
System.out.println(list);
}
}
Which List implementation provides the best performance for random access operations?
Which of the following statements is true about LinkedList?
It uses an array internally for storage
It allows fast random access using indexing
It has efficient insertions and deletions at both ends
It does not support null values
What will be the output of the following code?
Java
import java.util.*;
public class Test {
public static void main(String[] args) {
List<Integer> list = new LinkedList<>();
list.add(10);
list.add(20);
list.remove(0);
System.out.println(list);
}
}
What is the time complexity of ArrayList.add(index, element) operation in the worst case?
Which of the following List implementations is synchronized?
Which method is used to obtain a sublist from an existing List?
list.getSubset(start, end)
What will be the output of the following code?
Java
import java.util.*;
public class Test {
public static void main(String[] args) {
List<String> list = Arrays.asList("A", "B", "C");
list.add("D");
System.out.println(list);
}
}
There are 10 questions to complete.
Take a part in the ongoing discussion
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4