200k views
15 votes
1.The ___________ method adds a new element onto the end of the array.

A.add
B.input
C.append
D.len
2.A(n) ____________ is a variable that holds many pieces of data at the same time.
A.index
B.length
C.array
D.element
3.A(n) ____________ is a piece of data stored in an array.
A.element
B.length
C.array
D.index
4.Where does append add a new element?
A.To the end of an array.
B.To the beginning of an array.
C.To the middle of an array.
D.In alphabetical/numerical order.
5.Consider the following code that works on an array of integers:

for i in range(len(values)):
if (values[i] < 0):
values[i] = values [i] * -1
What does it do?

A.Changes all positives numbers to negatives.
B.Nothing, values in arrays must be positive.
C.Changes all negative numbers to positives.
D.Subtracts one from every value in the array.
6.Which of the following is NOT a reason to use arrays?
A.To quickly process large amounts of data.
B.Organize information.
C.To store data in programs.
D.To do number calculations.
7.Consider the following:

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

A.an index
B.an element
C.a list
D.a sum
8._____________ is storing a specific value in the array.

A.Indexing
B.Summing
C.Assigning
D.Iterating
9.Consider the following code:

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

print(stuff[3])
What is output?

A.zebra
B.bat
C.frog
D.['dog', 'cat', 'frog', 'zebra', 'bat', 'pig', 'mongoose']
10.Consider the following code:

tests = [78, 86, 83, 89, 92, 91, 94, 67, 72, 95]

sum = 0
for i in range(_____):
sum = sum + tests[i]

print("Class average: " + str((sum/_____)))
What should go in the ____________ to make sure that the code correctly finds the average of the test scores?

A.sum
B.val(tests)
C.len(tests)
D.len(tests) - 1

User Gberger
by
5.3k points

1 Answer

8 votes

Answer:

1. append

2. array

3. elament

4. To the end of an array.

5. Changes all negative numbers to positives.

6. To do number calculations.

7. an elament

8. Assigning

9. zebra

10. len(tests)

Step-by-step explanation:

got 100% on the test

User TGlatzer
by
4.4k points