Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CodeHS 5.4 & 5.5 ArrayList Stuff

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.

Arrays have a fixed size.

a)

true

b)

false

2.

ArrayLists have a fixed size.

a)

true

b)

false

3.

How do we set up a class to use ArrayLists?


Select all that apply.

a)

import java.util.*;

b)

import java.lang.*;

c)

import java.lang.ArrayList;

d)

import java.ArrayList.*;

e)

import java.util.ArrayList;

4.

Write a line of code to add the value 23 to the end of ArrayList foo.

(a)  

5.

Write a line of code to change the value at index 5 in the ArrayList foo to 42.

(a)  

6.

Write a line of code to retrieve the value at index 9 from the ArrayList foo and assign it to the int bar.

(a)  

7.

Write a line of code to get the length of ArrayList foo.

(a)  

8.

Write a line of code to remove the element at index 7 from the ArrayList foo.

(a)  

9.

ArrayList implements

a)

List

b)

Array

c)

ArrayList

d)

Object

e)

ListArray

10.

An array is kinda like ...

a)

a list

b)

a group

c)

a chess board

d)

a phonebook ... wait, do you even know what that is?