WorksheetsAP Computer Science Principles Review
Total questions: 34
Worksheet time: 34mins
Which of the following is NOT a benefit of collaborating to develop a computing innovation?
Collaboration can decrease the size and complexity of tasks required of individual team members.
Collaboration can make it easier to find and correct errors during the development process.
Collaboration eliminates the need to resolve differences of opinion.
Collaboration facilitates multiple perspectives in developing ideas.
In the following procedure, assume that the parameter x is an integer. Which of the following best describes the behavior of the procedure?
It displays nothing if x is negative and displays true otherwise.
It displays nothing if x is negative and displays false otherwise.
It displays true if x is negative and displays nothing otherwise.
It displays true if x is negative and displays false otherwise.
Directions: The question or incomplete statement below is followed by four suggested answers or completions. Select the one that is best in each case. Which of the following is a true statement about program documentation?
Program documentation should not be changed after it is first written.
Program documentation is only needed for programs in development; it is not needed after a program is completed.
Program documentation is useful when programmers collaborate but not when a programmer works individually on a project.
Program documentation is useful during initial program development and also when modifications are made to existing programs.
A computer program uses 3 bits to represent integers. When the program adds the decimal (base 10) numbers 5 and 3, the result is 0. Which of the following is the best explanation for the result?
An overflow error occurred.
A round-off error occurred.
The result was affected by lossy data compression.
The result was approximated by a floating-point representation.
Consider the 4-bit binary numbers 0011, 0110, and 1111. Which of the following decimal values is NOT equal to one of these binary numbers?
3
6
9
15
Which of the following is an advantage of a lossless compression algorithm over a lossy compression algorithm?
A lossless compression algorithm can guarantee that compressed information is kept secure, while a lossy compression cannot.
A lossless compression algorithm can guarantee reconstruction of original data, while a lossy compression algorithm cannot.
A lossless compression algorithm typically allows for faster transmission speeds than does a lossy compression algorithm.
A lossless compression algorithm typically provides a greater reduction in the number of bits stored or transmitted than does a lossy compression algorithm.
A list of binary values (0 or 1) is used to represent a black-and-white image. Which of the following is LEAST likely to be stored as metadata associated with the image?
Copyright information for the image
The date and time the image was created
The dimensions (number of rows and columns of pixels) of the image
A duplicate copy of the data
The owner of a clothing store records the following information for each transaction made at the store during a 7-day period: the date of the transaction, the method of payment used in the transaction, the number of items purchased in the transaction, and the total amount of the transaction, in dollars. Using only the data collected during the 7-day period, which of the following statements is true?
The average amount spent per day during the 7-day period can be determined by sorting the data by the total transaction amount, then adding the 7 greatest amounts, and then dividing the sum by 7.
The method of payment that was used in the greatest number of transactions during the 7-day period can be determined by sorting the data by the method of payment, then adding the number of items purchased for each type of payment method, and then finding the maximum sum.
The most expensive item purchased on a given date can be determined by searching the data for all items purchased on the given date and then sorting the matching items by item price.
The total number of items purchased on a given date can be determined by searching the data for all transactions that occurred on the given date and then adding the number of items purchased for each matching transaction.
Consider the following code segment. What is the value of r as a result of executing the code segment?
10
20
30
40
Which of the following is a benefit of using a list as a data abstraction in a program?
Lists often allow their size to be easily updated to hold as many data values as needed.
Lists convert all elements to strings so that they can be inspected character-by-character.
Lists prevent duplicate data values from appearing in the list.
Lists are used to store all input data so that there is a running record of all user input.
The code fragment below is intended to display "odd" if the positive number num is odd. Which of the following can be used to replace
(num MOD 1) = 0
(num MOD 1) = 1
(num MOD 2) = 0
(num MOD 2) = 1
Consider the following code segment. What is displayed as a result of executing the code segment?
true true true
false false false
true false true
false false true
An algorithm has been developed to compute the sum of all the elements in a list of integers. Which of the following programming structures must be added to the existing algorithm so that the new algorithm computes the sum of only the even integers in the list?
Iteration
Searching
Selection
Sequencing
Consider the following code segment with integer variables x and y. If x has a value of 7 and y has a value of 20, what is displayed as a result of executing the code segment?
A) ONE
B) TWO
C) THREE
D) FOUR
Consider the following code segment. What is the value of result after the code segment is executed?
A) 6
B) 10
C) 15
D) 21
Consider the following program. Which of the following expressions represents the value stored in the variable x as a result of executing the program?
2 * 3 * 3 * 3
2 * 4 * 4 * 4
2 * 3 * 3 * 3 * 3
2 * 4 * 4 * 4 * 4
Consider the following code segment. What is displayed as a result of executing the code segment?
1 3 5
5 3 1
100 300 500
500 300 100
A programmer is deciding between using a linear or binary search to find a target value in a sorted list. Which of the following is true?
In all cases, a binary search of a sorted list requires fewer comparisons than a linear search.
Generally, the advantage of using a binary search over a linear search increases as the size of the list increases.
A linear search will generally run faster than a binary search because a linear search requires fewer lines of code to implement.
Using a linear search is preferable to using a binary search if there is a chance that the target may not be found in the list.
Consider the following procedure. What is displayed as a result of executing the statement DISPLAY(doSomething(10, 20))?
10 10
10 20
10 10 20
10 20 10
A computer science student completes a program and asks a classmate for feedback. The classmate suggests rewriting some of the code to include more procedural abstraction. Which of the following is NOT a benefit of procedural abstraction?
Making the code more readable
Making the code run faster
Providing more opportunities for code reuse
Reducing the amount of duplicated code
A student has a data file containing 10,000 numerical values. The student is writing a program to compute the average of the numbers contained in the file. Which of the following procedures is most likely to be useful in the student's program?
A procedure that returns the quotient when dividing one value by another
A procedure that returns the sum when adding one value to another
A procedure that returns the sum of the values in the file
A procedure that returns true if the file contains any duplicate values and returns false otherwise
Consider the following code segment: [code segment with loop and random number generation]. Which of the following CANNOT be displayed as a result of executing the code segment?
1 1 1 1
1 2 3 2
1 2 3 4
1 3 2 4
Which of the following statements describes a limitation of using a computer simulation to model a real-world object or system?
Computer simulations can only be built after the real-world object or system has been created.
Computer simulations only run on very powerful computers that are not available to the general public.
Computer simulations usually make some simplifying assumptions about the real-world object or system being modeled.
It is difficult to change input parameters or conditions when using computer simulations.
Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem?
When the problem can be solved in a reasonable time and an approximate solution is acceptable
When the problem can be solved in a reasonable time and an exact solution is needed
When the problem cannot be solved in a reasonable time and an approximate solution is acceptable
When the problem cannot be solved in a reasonable time and an exact solution is needed
Which of the following best explains the ability to solve problems algorithmically?
Any problem can be solved algorithmically, though some algorithmic solutions may require humans to validate the results.
Any problem can be solved algorithmically, though some algorithmic solutions must be executed on multiple devices in parallel.
Any problem can be solved algorithmically, though some algorithmic solutions require a very large amount of data storage to execute.
There exist some problems that cannot be solved algorithmically using any computer.
Which of the following best explains the relationship between the Internet and the World Wide Web?
Both the Internet and the World Wide Web refer to the same interconnected network of devices.
The Internet is an interconnected network of data servers, and the World Wide Web is a network of user devices that communicates with the data servers.
The Internet is a local network of interconnected devices, and the World Wide Web is a global network that connects the local networks with each other.
The Internet is a network of interconnected networks, and the World Wide Web is a system of linked pages, programs, and files that is accessed via the Internet.
Which of the following is a primary benefit of making a computing system fault-tolerant?
If one component of the system fails, users of the system can often still access it.
If one component of the system is hacked, no information will be stolen.
If the system becomes too expensive, making it fault-tolerant will save money.
If the system cannot operate efficiently, making it fault-tolerant will speed up its operation.
Which of the following best describes the ability of parallel computing solutions to improve efficiency?
Any problem that can be solved sequentially can be solved using a parallel solution in approximately half the time.
Any solution can be broken down into smaller and smaller parallel portions, making the improvement in efficiency theoretically limitless as long as there are enough processors available.
The efficiency of parallel computing solutions is rarely improved over the efficiency of sequential computing solutions.
The efficiency of a solution that can be broken down into parallel portions is still limited by a sequential portion.
Which of the following best describes the purpose of machine learning programs?
To analyze large data sets, recognize patterns, and make predictions based on data
To automatically translate algorithms from natural language to machine language
To determine whether an algorithm can be constructed to answer “yes” or “no” for all possible inputs
To find approximate solutions to problems that would otherwise require an unreasonably long amount of time to solve
Which of the following school policies is most likely to have a positive impact on the digital divide?
A school allows students to bring a graphing calculator from home to complete in-class mathematics assignments.
A school allows students to bring a tablet computer to class every day to participate in graded quizzes.
A school provides a laptop or tablet computer to all students enrolled at the school.
A school recommends that all students purchase a computer with as much processing speed as possible so that projects run faster.
The developers of a music-streaming application are updating the algorithm they use to recommend music to listeners. Which of the following strategies is LEAST likely to introduce bias into the application?
Making recommendations based on listening data gathered from a random sample of users of the application
Making recommendations based on the most frequently played songs on a local radio station
Making recommendations based on the music tastes of the developers of the application
Making recommendations based on a survey that is sent out to the 1,000 most active users of the application
A mobile application is used to display local traffic conditions. Which of the following features of the application best exemplifies the use of crowdsourcing?
Users can save an address to be used at a later time.
Users can turn on alerts to be notified about traffic accidents.
Users can submit updates on local traffic conditions in real time.
Users can use the application to avoid heavily congested areas.
Which of the following is NOT an advantage of using open-source software?
Open-source software is generally free or lower in cost than commercially available software.
The availability of source code makes it possible to customize open-source software to a user’s individual needs.
The original developer of open-source software provides free or low-cost support for users installing and running the software.
Unlike commercial software, which can become obsolete when the company that created it goes out of business, open-source software can be updated without the involvement of the original programmers.
In public key cryptography, the sender uses the recipient’s public key to encrypt a message. Which of the following is needed to decrypt the message?
The sender’s public key
The sender’s private key
The recipient’s public key
The recipient’s private key
