wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Unit 5 -- Lists, Loops, Traversals

Total questions: 9

Worksheet time: 5mins

Name
Class
Date
1.

What is the definition of a List?

a)

An ordered collection of elements

b)

Where information is stored in a variable

c)

The number that identifies each individual element

d)

Where information is written in Java

2.

Which of the following creates a list in the code?

a)

var aList( )

b)

aList{ }

c)

var aList[ ]

d)

aList: ;

3.

Which of the following commands adds an element to the end of the list?

a)

append.list(element)

b)

append.Item(list, element)

c)

list.append()

d)

(element)append

4.

An Element is an individual value in a list that is assigned a unique index

a)

True

b)

False

5.

The length of a list is how many elements it contains. Lists can grow or shrink as elements are added or removed, but the length of the list does not change.

a)

True

b)

False

6.

What is the value at index 1

a)

74

b)

53

c)

22

d)

favNums

7.

What do code do we use to up the "counter" variable by 1 each time we traverse through a "for" loop?

a)

Var i = i + 1

b)

i = 0

c)

i ++

d)

i +

8.

We use a for loop to traverse a list, visiting each element one at a time.

a)

True

b)

False

9.

What will the output be?

a)

[1,4,12,8,6,9,4]

b)

[2,5,13,9,7,10,5]

c)

[4,7,15,11,9,12,7]

d)

[4,7,15,11,6,9,4]