category 1
Category 2
Category 3
100

What exception is thrown when you reach an index out of bounds in arraylist?

NullPointerException.

100

These methods are used to access and modify elements in an ArrayList.

.get() and .set()

100

How to initialize 2d array

<type>[][]

200

What is the exact syntax for importing ArrayList? 


import java.util.ArrayList;

200

Is there an error with the following, and if so, what is it? ArrayList list = {0, 1, 2, 3}; System.out.println(list[3]);

Yes, you use .get() instead of [].

200

What type of memory is an ArrayList?

heap

300

List two non-obvious differences between array and ArrayList.

dynamically sized, store multiple types, (answers can vary)

300

ArrayList list = new ArrayList();list.add(“A”);list.add(“B”);list.add(0,”C”);list.add(“D”);list.set(2,”E”);list.remove(1);System.out.println(list);

"C E D"

300

What are the two different signatures of .add(), and what do they each do? 

public boolean add(T item) adds to the end of the list. public void add(int index, T item) adds to index.

400

Determine whether each of the following is a method of ArrayList: .add(), .addAll(), .erase(), .removeFirst(), .set(), .size(), .length().

.add(), .addAll(), .set(), .size()

400

Is there an error with the following, and if so, what is it? ArrayList list = new ArrayList<int>(); list.add(1); list.add(Integer.parseInt("2"));

Yes, ArrayList can't store primitive types.

400

what row and column will arr[1][3] access

row 2 column 4