• Courses
  • Tutorials
  • Practice
Switch to Dark Mode

Java List Interface

Here are 10 essential multiple-choice questions on Java List Interface, covering key concepts.


Last Updated : Apr 1, 2025
Discuss
Comments

Question 1

Which of the following classes does NOT implement the List interface?

  • A

    ArrayList

  • B

    LinkedList

  • C

    HashSet


  • D

    Vector

Question 2

What is the default initial capacity of an ArrayList when created with a no-arg constructor?

  • A

    5

  • B

    10

  • C

    16

  • D

    0

Question 3

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);
    }
}


  • A

    [1, 2, 3, 10]

  • B

    [1, 10, 2, 3]

  • C

    Compilation Error

  • D

    Runtime Error

Question 4

Which List implementation provides the best performance for random access operations?

  • A

    LinkedList

  • B

    ArrayList

  • C

    Vector

  • D

    Stack

Question 5

Which of the following statements is true about LinkedList?

  • A

    It uses an array internally for storage

  • B

    It allows fast random access using indexing

  • C

    It has efficient insertions and deletions at both ends

  • D

    It does not support null values

Question 6

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);
    }
}


  • A

    [10]

  • B

    [20]


  • C

    Compilation Error


  • D

    Runtime Error

Question 7

What is the time complexity of ArrayList.add(index, element) operation in the worst case?


  • A

    O(1)

  • B

    O(log n)

  • C

    O(n)

  • D

    O(n log n)

Question 8

Which of the following List implementations is synchronized?


  • A

    ArrayList


  • B

    Vector

  • C

    LinkedList


  • D

    CopyOnWriteArrayList


Question 9

Which method is used to obtain a sublist from an existing List?

  • A

    list.getSubset(start, end)

  • B

    list.extract(start, end)

  • C

    list.subList(start, end)

  • D

    list.split(start, end)

Question 10

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);
    }
}


  • A

    [A, B, C, D]


  • B

    [A, B, C]

  • C

    Compilation Error

  • D

    Runtime Error

There are 10 questions to complete.

Take a part in the ongoing discussion