Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CP M.8.1-8.5 Quiz Review

Total questions: 15

Worksheet time: 10mins

Name
Class
Date
1.

In Python, an array is called a (a)   .

2.

A list stores data using multiple variable names.

a)

True

b)

False

3.

We use lists in programs to ______________ data.

a)

get external

b)

get user

c)

organize

4.

Where does append add the new elements?

a)

To the beginning of an array

b)

To the middle of an array

c)

To the end of an array

d)

In alphabetical/numerical order.

5.

The (a)   is the address/location of a piece of data.

6.

A(n) (a)   is an individual piece of data in an array.

7.

Consider the following code:

price = [24.99, 20.00, 12.50, 3.99]

This code is an example of a(n) ______________  _____________.

a)

output list

b)

index list

c)

initializer list

d)

parameter list

8.

Why do we use for loops with lists?

a)

Because they take user input.

b)

Because we do not know how many times the loop will repeat.

c)

Because they let us quickly process the contents of a list, which has many values.

d)

Because they allow us to test boolean conditions.

9.

The ___________ method adds a new element onto the end of the list.

a)

add

b)

input

c)

append

d)

len

10.

Consider the following code that works on a list of integers:

for i in range(len(values)):  

if (values[i] < 0):        

values[i] = values [i] * -1

What does it do?

a)

Changes all negative numbers to positives.

b)

Nothing, values in lists must be positive.

c)

Subtracts one from every value in the list.

d)

Changes all positives numbers to negatives.

11.

_____________ is storing a specific value in the list.

a)

Iterating

b)

Summing

c)

Indexing

d)

Assigning

12.

Arrays perform number calculations.

a)

True

b)

False

13.

Consider the following code:

stuff = ["dog", "cat", "frog", "zebra", "bat", "pig", "mongoose"]

print(stuff[5])

What is output?

a)

pig

b)

dog

c)

['dog', 'cat', 'frog', 'zebra', 'bat', 'pig', 'mongoose']

d)

print(stuff)

14.

Mark the correct position of the element.

15.

The ______() method allows us to add as many elements as we want.

a)

extend

b)

insert

c)

remove

d)

pop