4. Data Collections
Implementing Arraylist Algorithms — Quiz
Test your understanding of implementing arraylist algorithms with 5 practice questions.
Practice Questions
Question 1
In an $ArrayList$, which method adds an element to the end of the list?
Question 2
What is the index of the first element in an $ArrayList$?
Question 3
What does the expression $list.size()$ return for an $ArrayList$ named $list$?
Question 4
Which statement correctly removes the element at index $2$ from an $ArrayList$ named $numbers$?
Question 5
What happens when the following code runs? ArrayList<Integer> nums = new ArrayList<Integer>(); nums.add(4); nums.add(7); nums.add(2); nums.remove(1);
