In the temperature_counts function, which category should contain a temperature value of 32?
10. Integrated Problem-Solving Practice Online Quiz Questions
Use this free practice quiz with 20 questions to review 10. Integrated Problem-Solving Practice, test your knowledge, and prepare for your next test or exam.
According to summarize_scores, what does summarize_scores([6, 10, 14]) return?
- A
(3, 20, 10)
- B
(2, 30, 15)
- C
(3, 30, 10)
- D
(3, 30, 30)
Which precondition is necessary for the binary-search implementation in the material to be correct?
- A
The values must be sorted according to the comparison ordering.
- B
The list must contain only distinct values.
- C
The list must contain at least one element.
- D
The target must be larger than the first value.
Which two design decisions match the frequencies function described in the material? Select all correct choices.
- A
Use a mapping from each item to its count.
- B
Require the input list to be sorted first.
- C
Return an empty mapping when the input is empty.
- D
Maintain two parallel lists for items and counts.
Which two statements correctly describe the binary-search implementation in the material? Select all correct choices.
- A
Its worst-case time is O(n).
- B
Its worst-case time is O(log n).
- C
Its extra space is O(1).
- D
It requires an additional set containing every input value.
True or false: In an algorithm, an invariant is a statement that remains true at a specified point during execution.
- A
True
- B
False
True or false: If an algorithm is decidable, it must also be efficient for typical inputs.
- A
True
- B
False
What single-word growth descriptor describes the worst-case running time of the linear_search function?
The sorted list is [1, 2, 2, 2, 5]. What integer index should first_occurrence(values, 2) return? Enter the zero-based index only.
Complete the corrected average function's return expression: return total / .
Complete the loop body so find_first_even progresses when the current value is odd: if values[index] % 2 == 0: return values[index] followed by .
Explain why has_duplicate_fast is generally more efficient than has_duplicate_slow. Compare their time complexity, extra-space usage, and the trade-off involved.
What does the provided binary_search([], 4) return?
- A
It raises an index error.
- B
It returns -1 without entering the loop.
- C
It returns 0 because the list has no elements.
- D
It enters an infinite loop.
According to the temperature_counts function, how is a temperature of 32 classified?
- A
below freezing
- B
comfortable
- C
hot
- D
invalid input
What does summarize_scores([]) return according to the stated design?
- A
(0, 0, 0)
- B
(0, None, None)
- C
(0, 0, None)
- D
([], 0, None)
Using the averaging rule in summarize_scores, what is the average of the scores [6, 8, 10]?
What one-word descriptor characterizes how the worst-case running time of linear search grows with the input size?
True or false: Binary search is appropriate only when the data is sorted according to the same ordering used by its comparisons.
- A
True
- B
False
Why is has_duplicate_fast generally more efficient than has_duplicate_slow for a large list?
- A
It uses no additional memory and guarantees O(1) time.
- B
It uses O(n) time but always uses less memory than the nested-loop method.
- C
It usually reduces expected running time to O(n) by using additional memory.
- D
It sorts the input first, so its worst-case time is O(log n).
For the sorted list [1, 2, 2, 2, 5], why does first_occurrence([1, 2, 2, 2, 5], 2) return index 1 rather than index 2 or 3?
- A
It returns immediately at the first matching index.
- B
It records the match and continues searching the left half.
- C
It discards the left half and searches only for a later match.
- D
It changes the list so duplicate values are removed.
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.