A program stores values in the list values ← [12, 18, 25, 31]. Which value does values[1] produce?
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.
True or false: For a list with length 4 using zero-based indexing, index 4 refers to the last element.
- A
True
- B
False
What common list operation adds one element at the end of a collection?
The list is results ← [72, 88, 91]. After executing results[0] ← 79, what is the resulting list?
- A
[79, 88]
- B
[72, 88, 91, 79]
- C
[79, 88, 91]
- D
[72, 88, 91]
A traversal uses total ← 0 and adds each value in numbers ← [4, 8, 15] to total. After the traversal, total is .
Select all statements that correctly describe collection-processing patterns.
- A
Filtering can place only qualifying elements into a new list.
- B
In-place modification always leaves the original list unchanged.
- C
Transformation can create a new value for each original element.
- D
Filtering must change every element in the original list.
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.
- A
True
- B
False
A sequential search examines items ← [12, 7, 19, 4] for the target 19. What zero-based index should the search return?
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?
- A
-8
- B
-2
- C
0
- D
5
In the provided findIndex sequential-search algorithm, searching [12, 7, 19, 4] for 10 returns .
Select all cases that are specifically recommended as useful tests for a list-search or indexing algorithm.
- A
An empty list
- B
A target at the first index
- C
Only a target in the middle of a long list
- D
A target at the last index
- E
A target that does not occur
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.
Given grades ← [[80, 90, 85], [75, 88, 92]], which value does grades[1][2] produce?
- A
80
- B
90
- C
92
- D
75
A list has length 5 and uses zero-based indexing. What is its last valid index?
- A
0
- B
4
- C
5
- D
6
Given results ← [72, 88, 91], the statement results[0] ← 79 is executed. What is the resulting list?
- A
[79, 72, 88, 91]
- B
[72, 88, 91, 79]
- C
[79, 88, 91]
- D
[72, 79, 88, 91]
A filtering algorithm appends a score to passing only when score >= 60. If scores = [72, 55, 91], what is passing after the traversal?
- A
[72, 91]
- B
[55, 72, 91]
- C
[55]
- D
[72, 55, 91]
Using a sequential search that returns the index of the first matching element, what does searching [12, 7, 19, 4] for 19 return?
- A
1
- B
2
- C
3
- D
-1
True or false: For a list of length 4 using zero-based indexing, accessing items[4] is usually invalid.
- A
True
- B
False
An accumulator starts at 0 and traverses numbers = [4, 8, 15], adding each value to total. What final total is produced?
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?
Related study packs and tools
AP Computer Science A: Integrated Java Problem Solving
A practical review of the integrated Java skills, debugging habits, algorithm reasoning, and free-response strategies needed for AP Computer Science A.
Fault Tolerance and Redundant Systems
A progressive guide to designing, operating, and testing systems that continue useful service despite component faults, overload, data loss, and recovery challenges.
How the Internet Works
A medium-difficulty quiz on how independently operated networks, protocols, addresses, naming systems, transport services, and routing mechanisms work together to form the Internet.
Java ArrayList and Collections: Operations, Traversals, and Algorithms
Learn how to create, modify, traverse, and analyze Java lists with ArrayList, wrapper types, standard algorithms, and the Collections utility class for AP Computer Science A.
Java Boolean Logic and Selection
Build a clear understanding of Java Boolean expressions, logical operators, selection statements, nested branching, equivalent logic, and systematic code tracing for AP Computer Science A.
Java Foundations and Program Design
A practical introduction to Java program structure, data types, operators, input and output, problem-solving strategy, testing, and debugging for AP Computer Science A.
Java Inheritance and Polymorphism
A practical guide to Java inheritance, constructor chaining, method overriding, polymorphism, access control, and object behavior for tracing and writing AP Computer Science A programs.
Java Objects, Classes, and the String API
A focused guide to Java classes, object references, constructors, methods, strings, wrapper classes, and API usage for AP Computer Science A.
Java Primitive Types and Expression Evaluation
A focused guide to Java primitive types, expression evaluation, numeric conversion, floating-point behavior, integer overflow, and common methods in the Math class for AP Computer Science A.
Java Primitive Types and Expressions
A focused review of Java primitive types, expression evaluation, numeric conversion, arithmetic behavior, Math methods, randomness, and tracing techniques for AP Computer Science A.
Packets, Links, and Network Performance
A progressive guide to how packet-switched networks encapsulate data, move it across links, and manage delay, throughput, queues, and congestion.
Parallel and Distributed Computing
A structured guide to designing parallel and distributed systems through decomposition, communication, coordination, state management, scalability, and fault tolerance.