AP CSP Practice Exam Full #1
AP CSP Practice Exam Full #1
AP CSP Practice Exam Full #1
Instruction Explanation
Assignment, Display, and Input
Text: Evaluates expression and assigns the result to
a ← expression the variable a.
Block:
关注公众号omni_xyz获得更多AP备考资源
14 AP Computer Science Principles Practice Exam
REFERENCE MATERIALS
Instruction Explanation
Relational and Boolean Operators (continued)
Text: Evaluates to true if condition1 is true
condition1 OR condition2 or if condition2 is true or if both
condition1 and condition2 are true;
Block:
otherwise evaluates to false.
Selection
Text: The code in block of statements is
IF (condition) executed if the Boolean expression condition
Iteration
Text: The code in block of statements is
REPEAT n TIMES executed n times.
{
<block of statements>
}
Block:
关注公众号omni_xyz获得更多AP备考资源
AP Computer Science Principles Practice Exam 15
REFERENCE MATERIALS
Instruction Explanation
Iteration (continued)
Text: The code in block of statements is
REPEAT UNTIL (condition) repeated until the Boolean expression
{ condition evaluates to true.
<block of statements>
}
Block:
关注公众号omni_xyz获得更多AP备考资源
16 AP Computer Science Principles Practice Exam
REFERENCE MATERIALS
Instruction Explanation
List Operations (continued)
Text: Any values in list at indices greater than or
INSERT (list, i, value) equal to i are shifted to the right. The length of
list is increased by 1, and value is placed at
Block:
index i in list.
Procedures
Text: A procedure, name, takes zero or more
PROCEDURE name (parameter1, parameters. The procedure contains programming
parameter2, ...) instructions.
{
<instructions>
}
Block:
Block:
关注公众号omni_xyz获得更多AP备考资源
AP Computer Science Principles Practice Exam 17
REFERENCE MATERIALS
Instruction Explanation
Robot
If the robot attempts to move to a square that is not open or is beyond the edge of the grid, the robot will
stay in its current location and the program will terminate.
Text: The robot moves one square forward in the
MOVE_FORWARD () direction it is facing.
Block:
关注公众号omni_xyz获得更多AP备考资源
18 AP Computer Science Principles Practice Exam
Directions: Each of the questions or incomplete statements below is followed by four suggested answers or completions.
Select the one that is best in each case and then fill in the corresponding circle on the answer sheet.
1. The code segment below is intended to swap the values of the variables first and second using a
temporary variable, temp.
(B)
(C)
(D)
2. A bank customer receives an e-mail from a sender claiming to be a bank employee. The e-mail asks the
customer to provide personal information and to call a phone number if he or she has any questions. The
customer suspects the e-mail might be a phishing attempt. Which of the following responses is most likely to be
a privacy risk for the bank customer?
(A) Calling the bank at its official phone number to ask whether the request for personal information is
legitimate
(B) Calling the phone number given in the e-mail and providing the personal information over the phone
(C) Checking that the domain name of the sender’s e-mail address is associated with the bank
(D) Conducting a Web search to see if other people have received similar requests for personal information
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
(A) An experiment that requires all participants to be working in the same laboratory
(B) An experiment that requires expensive equipment to conduct
(C) An experiment that requires data measurements to be taken in many different locations
(D) An experiment that requires specialized knowledge and training to conduct
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
(C) (D)
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
Which of the following can be used to replace <MISSING CODE> so that the procedure correctly simulates
the spinner?
(A) (B)
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
13. The researchers noticed that the total number of registered users appears to be increasing at about a constant
rate. If this pattern continues, which of the following best approximates the total number of registered users, in
millions, in year 12 (two years after the last entry in the table) ?
(A) 30.6
(B) 31.2
(C) 31.8
(D) 32.4
14. Which of the following hypotheses is most consistent with the data in the table?
(A) The mobile app release did not have any effect on the average number of daily messages sent per user.
(B) The mobile app release discouraged new user registration on the site.
(C) The mobile app release led to users being less frequently active on the site.
(D) The mobile app release led to users tending to write shorter messages.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
(A) Gathering data for additional years to try to identify patterns in birth rates
(B) Refining the model used in the computer simulation to more closely reflect the data from the past ten years
20. A library of e-books contains metadata for each book. The metadata are intended to help a search feature find
books that users are interested in. Which of the following is LEAST likely to be contained in the metadata of
each e-book?
(A) An archive containing previous versions of the e-book
(B) The author and title of the e-book
(C) The date the e-book was first published
(D) The genre of the e-book (e.g., comedy, fantasy, romance, etc.)
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
Which of the following code segments will move the robot to the gray square?
(A) (B)
(C) (D)
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
26. For which of the following strings is it NOT possible to use byte pair encoding to shorten the string’s length?
(A) "BANANA"
(B) "LEVEL_UP"
(C) "MEET_ME_LATER"
(D) "NEITHER_HERE_NOR_THERE"
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
(A) As computer hardware improves, the algorithms used in programs will become more efficient.
(B) As computer hardware improves, developers will become more skilled at writing code.
(C) As computer hardware improves, future computers will be able to run faster than current computers.
(D) As computer hardware improves, the number of cybersecurity concerns will increase.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
For which of the following input values will the circuit have an output of false?
(A) A = true, B = false, C = false, D = false
(B) A = true, B = true, C = false, D = false
(C) A = false, B = false, C = true, D = true
(D) A = false, B = false, C = false, D = true
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
(A) 1 hour
(B) 2 hours
(C) 4 hours
(D) 5 hours
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
(A) 0099A1
(B) A10099
(C) A100B0
36. Participants in a survey were asked how many hours per day they spend reading, how many hours per day they
spend using a smartphone, and whether or not they would be interested in a smartphone application that lets
users share book reviews.
The data from the survey are represented in the graph below. Each × represents a survey participant who said he
or she was interested in the application, and each O represents a participant who said he or she was not
interested.
Which of the following hypotheses is most consistent with the data in the graph?
(A) Participants who read more were generally more likely to say they are interested in the application.
(B) Participants who read more were generally less likely to say they are interested in the application.
(C) Participants who use a smartphone more were generally more likely to say they read more.
(D) Participants who use a smartphone more were generally less likely to say they read more.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
Block Explanation
The start or end of the algorithm
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
39. The latency of a network connection is most appropriately measured with which of the following units?
(A) Bits per byte
(B) Bits per second
(C) Bytes
(D) Milliseconds
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
(A) Open standards and protocols allow different manufacturers and developers to build hardware and software
that can communicate with hardware and software on the rest of the network.
(B) Open standards and protocols provide ways for users to eliminate the latency of messages they send on the
Internet.
(C) Open standards and protocols allow users to freely share or reuse material found on the Internet for
noncommercial purposes.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
• Khalil does better on the midterm exam than on the final exam, so his original midterm and
final exam scores are added to compute his total points.
• Josefina does better on the final exam than on the midterm exam, so her final exam score
replaces her midterm exam score in the total points calculation.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
46. A programmer is writing a procedure to calculate a student’s final grade in the course using the score
replacement policy described. The student’s exam scores are stored in the variables midtermExam and
finalExam. The procedure Max (a, b) returns the larger of a and b.
Which of the following could be used in the procedure to calculate a student’s total points earned in the course
and store the result in the variable adjustedTotal?
(A) adjustedTotal ← Max (midtermExam, finalExam)
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
48. An online retailer uses an algorithm to sort a list of n items by price. The table below shows the approximate
number of steps the algorithm takes to sort lists of different sizes.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
(A) I only
50. A NAND gate is a type of logic gate that produces an output of false only when both of its two inputs
are true. Otherwise, the gate produces an output of true. Which of the following Boolean expressions
correctly models a NAND gate with inputs P and Q ?
(A) (NOT P) AND (NOT Q)
(B) (NOT P) AND Q
(C) NOT (P AND Q)
(D) NOT (P OR Q)
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
(A) It is possible to create an algorithm that will solve the problem for all programs and inputs, but the
algorithm can only be implemented in a low-level programming language.
(B) It is possible to create an algorithm that will solve the problem for all programs and inputs, but the
52. 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?
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
Which of the following could replace <MISSING EXPRESSION> in line 2 so that the code segment works as
intended?
(A) end - start + 1
(B) end - start + 6
(C) ((end - start) / 5) + 1
(D) 5 * (end - start) + 1
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
(A) Evy buys a locked box that operates using two different codes. When the first code is entered, a slot opens
that allows a message to be put in the box. When the second code is entered, the door to the box opens.
Evy gives the first code to her friends so they can leave messages for her and keeps the second code to
herself so that she is the only one who can retrieve the messages.
(B) Finn and Gwen develop a system that maps each letter of the alphabet to a unique symbol using a secret
key. Finn uses the key to write a message to Gwen where each letter is replaced with the corresponding
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
The programmer knows that the following steps are necessary for the algorithm but is not sure in which order
they should be executed.
58. Which of the following best describes the purpose of machine learning programs?
(A) To analyze large data sets, recognize patterns, and make predictions based on data
(B) To automatically translate algorithms from natural language to machine language
(C) To determine whether an algorithm can be constructed to answer “yes” or “no” for all possible inputs
(D) To find approximate solutions to problems that would otherwise require an unreasonably long amount of
time to solve
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.
60. A student wrote the procedure below, which is intended to ask whether a user wants to keep playing a game.
The procedure does not work as intended.
PROCEDURE KeepPlaying ()
{
DISPLAY ("Do you want to continue playing (y/n)?")
response ← INPUT ()
IF ((response = "y") AND (response = "yes"))
{
RETURN (true)
}
ELSE
{
RETURN (false)
}
}
Which of the following best describes the result of running the procedure?
(A) The procedure returns true when the user inputs the value "y" and returns false otherwise.
(B) The procedure returns true when the user inputs the value "n" and returns false otherwise.
(C) The procedure returns true no matter what the input value is.
(D) The procedure returns false no matter what the input value is.
关注公众号omni_xyz获得更多AP备考资源
GO ON TO THE NEXT PAGE.