wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PreTrainingCollectionsArrays

Total questions: 9

Worksheet time: 7mins

Name
Class
Date
1.

Which of the following is a difference between an Array and an ArrayList?

a)

Arrays can change in size

b)

ArrayLists can store primitive values

c)

Arrays are not a class in the collections Framework

d)

ArrayLists can be created with an array literal

2.

How do we retrieve an element at a particular index from an ArrayList?

a)

using square brackets

b)

using the find method

c)

using the get method

d)

using the pop method

3.

True/False: collections can contain primitive variables

a)

True

b)

False

4.

Which of the following is true for a HashMap?

a)

HashMaps can be used in a for-each loop

b)

HashMaps can store duplicate keys

c)

HashMaps store entries in Key,Value pairs

d)

HashMaps can store primitive values

5.

Queues store values in __in, __out order

a)

Last, First

b)

First, Last

c)

First, First

6.

Stacks store values in __in, __out order

a)

Last, Last

b)

First, First

c)

Last, First

7.

To pull an element from a queue and reduce the size by 1, we use the ____ method

a)

find

b)

push

c)

poll

d)

get

8.

Array indexes start at _

a)

0

b)

1

c)

10

d)

11

9.

To get the 5th item in an array or ArrayList, we would get index _

a)

6

b)

5

c)

4