Free Practice Quiz Question List

07. Lists, Arrays, and Sequential Data Online Quiz Questions

Use this free practice quiz with 20 questions to review 07. Lists, Arrays, and Sequential Data, test your knowledge, and prepare for your next test or exam.

20 questions
01
Choose one
1 point

A program stores values in the list values ← [12, 18, 25, 31]. Which value does values[1] produce?

  1. A

    12

  2. B

    18

  3. C

    25

  4. D

    31

02
True or false
1 point

True or false: For a list with length 4 using zero-based indexing, index 4 refers to the last element.

  1. A

    True

  2. B

    False

03
Written response
1 point

What common list operation adds one element at the end of a collection?

04
Choose one
1 point

The list is results ← [72, 88, 91]. After executing results[0] ← 79, what is the resulting list?

  1. A

    [79, 88]

  2. B

    [72, 88, 91, 79]

  3. C

    [79, 88, 91]

  4. D

    [72, 88, 91]

05
Fill in the blank
1 point

A traversal uses total ← 0 and adds each value in numbers ← [4, 8, 15] to total. After the traversal, total is .

06
Choose all
1 point

Select all statements that correctly describe collection-processing patterns.

  1. A

    Filtering can place only qualifying elements into a new list.

  2. B

    In-place modification always leaves the original list unchanged.

  3. C

    Transformation can create a new value for each original element.

  4. D

    Filtering must change every element in the original list.

07
True or false
1 point

True or false: A value-only loop such as for each value in numbers is sufficient by itself to replace every original list element with a modified value.

  1. A

    True

  2. B

    False

08
Written response
1 point

A sequential search examines items ← [12, 7, 19, 4] for the target 19. What zero-based index should the search return?

09
Choose one
1 point

A list may contain only negative values: numbers ← [-8, -15, -2, -11]. If an algorithm correctly finds the maximum by initializing from the first element, what maximum should it produce?

  1. A

    -8

  2. B

    -2

  3. C

    0

  4. D

    5

10
Fill in the blank
1 point

In the provided findIndex sequential-search algorithm, searching [12, 7, 19, 4] for 10 returns .

11
Choose all
1 point

Select all cases that are specifically recommended as useful tests for a list-search or indexing algorithm.

  1. A

    An empty list

  2. B

    A target at the first index

  3. C

    Only a target in the middle of a long list

  4. D

    A target at the last index

  5. E

    A target that does not occur

12
Open ended
1 point

Explain the differences among filtering, transformation, and in-place modification of a list. For each pattern, describe what happens to the original collection and give the essential relationship between the input and output elements.

13
Choose one
1 point

Given grades ← [[80, 90, 85], [75, 88, 92]], which value does grades[1][2] produce?

  1. A

    80

  2. B

    90

  3. C

    92

  4. D

    75

14
Choose one
1 point

A list has length 5 and uses zero-based indexing. What is its last valid index?

  1. A

    0

  2. B

    4

  3. C

    5

  4. D

    6

15
Choose one
1 point

Given results ← [72, 88, 91], the statement results[0] ← 79 is executed. What is the resulting list?

  1. A

    [79, 72, 88, 91]

  2. B

    [72, 88, 91, 79]

  3. C

    [79, 88, 91]

  4. D

    [72, 79, 88, 91]

16
Choose one
1 point

A filtering algorithm appends a score to passing only when score >= 60. If scores = [72, 55, 91], what is passing after the traversal?

  1. A

    [72, 91]

  2. B

    [55, 72, 91]

  3. C

    [55]

  4. D

    [72, 55, 91]

17
Choose one
1 point

Using a sequential search that returns the index of the first matching element, what does searching [12, 7, 19, 4] for 19 return?

  1. A

    1

  2. B

    2

  3. C

    3

  4. D

    -1

18
True or false
1 point

True or false: For a list of length 4 using zero-based indexing, accessing items[4] is usually invalid.

  1. A

    True

  2. B

    False

19
Written response
1 point

An accumulator starts at 0 and traverses numbers = [4, 8, 15], adding each value to total. What final total is produced?

20
Written response
1 point

A sequential-search function returns the matching index or -1 when no match exists. What does it return when searching [12, 7, 19, 4] for 10?