AP Comp Sci Princ 3rd Ed Practice Test 4
AP Comp Sci Princ 3rd Ed Practice Test 4
Section I
The Exam
AP® Computer Science Principles Exam
SECTION I: Multiple-Choice Questions
Instructions
At a Glance
Section I of this examination contains 70 multiple-choice questions. Fill in only the ovals for
Total Time numbers 1 through 70 on your answer sheet.
2 hours
Indicate all of your answers to the multiple-choice questions on the answer sheet. No credit
Number of Questions
will be given for anything written in this exam booklet, but you may use the booklet for notes
70 or scratch work. After you have decided which of the suggested answers is best, completely
Percent of Total Score fill in the corresponding oval on the answer sheet. Give only one answer to each question. If
70% you change an answer, be sure that the previous mark is erased completely. Here is a sample
Writing Instrument question and answer.
Pencil required
Sample Question Sample Answer
Chicago is a A B C D E
(A) state
(B) city
(C) country
(D) continent
Use your time effectively, working as quickly as you can without losing accuracy. Do not
spend too much time on any one question. Go on to other questions and come back to the
ones you have not answered if you have time. It is not expected that everyone will know the
answers to all the multiple-choice questions.
About Guessing
Many candidates wonder whether or not to guess the answers to questions about which
they are not certain. Multiple-choice scores are based on the number of questions answered
correctly. Points are not deducted for incorrect answers, and no points are awarded for
unanswered questions. Because points are not deducted for incorrect answers, you are
encouraged to answer all multiple-choice questions. On any questions you do not know the
answer to, you should eliminate as many choices as you can, and then select the best answer
among the remaining choices.
2 | Practice Test 4
Section I
Quick Reference
Instruction Explanation
Assignment, Display, and Input
Text: Evaluates expression and then assigns a copy of the result to
a ← expression the variable a.
Block:
a expression
Block:
DISPLAY expression
Text: Accepts a value from the user and returns the input value.
INPUT()
Block:
INPUT
RANDOM a, b
Practice Test 4 | 3
Section I
Instruction Explanation
Relational and Boolean Operators
Text and Block: The relational operators =, ≠, >, <, ≤, and ≥ are used
a = b to test the relationship between two variables, expressions,
or values. A comparison using relational operators evaluates
a ≠ b to a Boolean value.
a > b
For example, a = b evaluates to true if a and b are equal;
a < b otherwise it evaluates to false.
a ≥ b
a ≤ b
Block:
NOT condition
Block:
condition1 AND condition2
Selection
Text: The code in block of statements is executed if the
IF(condition) Boolean expression condition evaluates to true; no
action is taken if condition evaluates to false.
{
<block of statements>
}
Block:
IF condition
block of statements
4 | Practice Test 4
Section I
Instruction Explanation
Selection—Continued
Text: The code in first block of statements is executed
IF(condition) if the Boolean expression condition evaluates to true;
otherwise the code in second block of statements is
{ executed.
<first block of statements>
}
ELSE
{
<second block of statements>
}
Block:
IF condition
ELSE
Iteration
Text: The code in block of statements is executed n times.
REPEAT n TIMES
{
<block of statements>
}
Block:
REPEAT n TIMES
block of statements
{
<block of statements>
}
Block:
block of statements
Practice Test 4 | 5
Section I
Instruction Explanation
List Operations
For all list operations, if a list index is less than 1 or greater than the length of the list, an error message is produced and the
program terminates.
Text: Creates a new list that contains the values value1, value2,
aList ← [value1, value2, value3, ...] value3, and ... at indices 1, 2, 3, and ... respectively
and assigns it to aList.
Block:
aList valuel, value2, value3
6 | Practice Test 4
Section I
Instruction Explanation
List Operations—Continued
Text: The length of aList is increased by 1, and value is placed at
APPEND(aList, value) the end of aList.
Block:
APPEND aList, value
Text: Removes the item at index i in aList and shifts to the left
REMOVE(aList, i) any values at indices greater than i. The length of aList is
decreased by 1.
Block:
REMOVE aList, i
block of statements
block of statements
Practice Test 4 | 7
Section I
Instruction Explanation
Procedures and Procedure Calls—Continued
Text: Defines procName as a procedure that takes zero or more
PROCEDURE procName(
parameter1, arguments. The procedure contains block of statements
parameter2, ...) and returns the value of expression. The RETURN statement
may appear at any point inside the procedure and causes an
{ immediate return from the procedure back to the calling
<block of statements> statement.
RETURN(expression) The value returned by the procedure procName can be assigned
} to the variable result using the following notation:
result ← procName(arg1, arg2, ...)
Block:
block of statements
RETURN expression
Text: Returns the flow of control to the point where the procedure was
RETURN(expression) called and returns the value of expression.
Block:
RETURN expression
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 direction it is facing.
MOVE_FORWARD()
Block:
MOVE_FORWARD
Block:
ROTATE_LEFT
Block:
ROTATE_RIGHT
8 | Practice Test 4
Section I
Practice Test 4 | 9
Section I
The drawRectangle method will be used to draw the following on a coordinate grid.
12
11
10
9
8
7
6
5
4
3
2
1
0
1 2 3 4 5 6 7 8 9 10 11 12
10 | Practice Test 4
Section I
Which of the following code segments can be used to draw the rectangles?
(A) x ← 1 (C) x ← 10
y ← 11 y ← 5
REPEAT 4 TIMES REPEAT 4 TIMES
{ {
drawRectangle(1, 11, 3, 7) drawRectangle(x, y, x+2, y-4)
x ← x + 3 x ← x - 3
y ← y + 2 y ← y + 2
} }
(B) x ← 11 (D) x ← 10
y ← 1 y ← 5
REPEAT 4 TIMES REPEAT 4 TIMES
{ {
drawRectangle(x, y, x+3, y+7) drawRectangle(x, y, x+2, y+4)
x ← x + 3 x ← x - 3
y ← y + 2 y ← y + 2
} }
3. A concert is selling tickets online only for an upcoming show. The management is trying to use metadata from each sale to
attempt to figure out what they should charge in the future for similar concerts. Here is the metadata taken from each sale.
• The time and the seat location of each ticket purchased
• The name and age of the purchaser
• The geolocation of the purchaser
Using the metadata given to us, which of the following CANNOT be analyzed to help determine future ticket prices?
(A) The seat locations of tickets that sold the fastest
(B) The financial status of each purchaser
(C) The amount of people who are most likely coming from out of town to see the concert
(D) The amount of time it took for the tickets to sell out
Practice Test 4 | 11
Section I
Compares user
true inputted password to false
password received as
parameter
Procedure Increment
returns true counter
true false
if counter = 3
Procedure
returns false
Which of the following code segments works correctly for this storyboard?
(A) (C)
PROCEDURE correctPassword(password) PROCEDURE correctPassword(password)
{ {
counter ← 0 counter ← 0
REPEAT UNTIL (counter = 3) REPEAT UNTIL (counter = 3)
{ {
DISPLAY(“Enter the password:”) DISPLAY(“Enter the password:”)
pw ← INPUT pw ← INPUT
IF (password = pw) IF (password = pw)
RETURN(true) RETURN(true)
} ELSE
} counter ← counter + 1
}
RETURN(false)
}
(B) (D)
PROCEDURE correctPassword(password) PROCEDURE correctPassword(password)
{ {
correct = false REPEAT 3 TIMES
REPEAT 3 TIMES {
{ DISPLAY(“Enter the password:”)
DISPLAY(“Enter the password:”) pw ← INPUT
pw ← INPUT IF (password = pw)
IF (password = pw) RETURN(true)
correct = true ELSE
ELSE RETURN(false)
correct = false }
} }
RETURN(correct)
}
GO ON TO THE NEXT PAGE.
12 | Practice Test 4
Section I
6. Using a binary system with only 4 bits, if the decimal numbers 8 and 10 were added together, the sum would be 0010. What
would be the reason for the incorrect answer?
(A) A truncating error
(B) A rounding error
(C) An overflow error
(D) An addition error
x ← someMath(10, 6)
y ← someMath(2, x)
z ← someMath(x, y)
DISPLAY(z)
(A) 2
(B) 4
(C) 24
(D) 32
Practice Test 4 | 13
Section I
8. Which of the following helps to explain the purpose of using comments in code?
I. Using comments helps keep the documentation current when changes are made to the code.
II. When using previous code segments, such as procedures, a coder can read the comments
and know what to do without even looking at the code.
III. When someone in the future needs to make changes to the code, they can look through
the comments to find what changes need to be made instead of dissecting the entire code.
(A) I only
(B) I and II only
(C) II and III only
(D) I, II, and III
9. There is a disclaimer on a website that the information provided could be used for crowdsourcing. What would be an example
of crowdsourcing using data that has been obtained by a website that collects health information and how a person feels daily?
(A) Using the daily information to figure out if people with certain medical information feel ill more often than others
(B) Creating an online fundraiser for people who are in need of financial assistance because of their medical situations
(C) Not allowing any of the people’s information to be used by any other institutions because of privacy concerns
(D) Using the data to determine what people are losing their jobs and how to better reach these people
10. The 8-digit binary number 0110 0011 would be how many digits if converted to hexadecimal?
(A) 63
(B) 8
(C) 3
(D) 2
14 | Practice Test 4
Section I
Which of the following best describes how this code segment works?
(A) The code segment will replace all negative indexes in myList with 0 and return mylist.
(B) The code segment will have an error since it will go out of bounds on myList.
(C) The code segment will find all values in myList that are 0 and remove them, and then return myList.
(D) The code segment will count how many values in myList are negative, and return that value.
13. What would be the output from the following code segment?
a ← 28
b ← 5
c ← a MOD b
DISPLAY (c)
(A) 2
(B) 3
(C) 5
(D) 5.6
Practice Test 4 | 15
Section I
14. A large spreadsheet contains the following data about a company. Here is a small sample of what the data could look like. The
top row is the header.
The company has to figure out which employees with the job title “Sales” need to be promoted to “Manager.” In order to be
promoted, an employee must fit the following criteria.
Which of the following would be the most efficient way to find all the employees that should be promoted?
(A) Filter out all employees with the Job Title “Manager”
Sort by Revenue
Sort by Number of Years
(B) Sort by Job Title
Sort by Number of Years
Create another column with the formula (Revenue − Expenses)
Filter out all employees with a value 0 or lower in the new column
(C) Manually remove all employees with the Job Title “Manager”
Manually remove all employees with Number of Years less than 5
Create another column with the formula (Revenue − Expenses)
Manually remove all numbers less than or equal to 0 from the new column
(D) Filter out all employees with the Job Title “Manager”
Filter out all employees with Number of Years less than 5
Create another column with the formula (Revenue − Expenses)
Sort the new column, and delete all that are less than or equal to 0
16 | Practice Test 4
Section I
15. Computer A uses sequential computing and has one processor. Computer B uses parallel computing and has two identical
processors that run in parallel. Each of these processors can only run one process at a time. No process can be split into two
different processors.
There are three processes that need to be run, and they can be run in any order. One of the processes takes 10 minutes, one of
the processes takes 15 minutes, and the final process takes 22 minutes. How much longer will it take Computer A to run the
three processes than it will take Computer B?
(A) Same amount of time
(B) 3 minutes
(C) 22 minutes
(D) 25 minutes
16. There are currently twenty employees at a store. The store is planning on opening up four new locations, each of which will
have twenty employees. This means that the company will now have 100 employees.
Currently, each employee has an ID number that is only five bits long and contains only 0s and 1s. How many more bits must
the company add to its current five-bit employee ID system so all 100 employees can have a unique ID number of 0s and 1s,
without wasting any extra bits?
(A) 0
(B) 1
(C) 2
(D) 3
17. A company will begin to use software through a third party that will allow them to log on to their servers more securely. Each
employee will log on every day, and that login will give them access to their email and workspace. Which of the following
would be an example of a phishing attack that could occur against the company?
(A) An employee receives an email to change their password but is instead sent to a fake website. This leads to them giving
away their password, which the cybercriminal uses to steal important company information.
(B) A hacker tries over and over to guess someone’s password, using certain information about the person, such as birthday,
address, child’s name, etc., and then pretends to be that person.
(C) A cybercriminal gets software downloaded onto an employee’s computer in an attempt to damage or slow down the new
login system.
(D) An employee unintentionally downloads software to the system, and that software allows the cybercriminal to take over
the computer to launch more attacks on the system.
Practice Test 4 | 17
Section I
18. Which of the code segments would produce the following output?
0 0
0 1
0 2
1 1
1 2
2 2
(A) (C)
x ← 0 x ← 0
REPEAT UNTIL (x = 3) y ← 0
{ REPEAT UNTIL (x = 3)
y ← x {
REPEAT UNTIL (y = 3) REPEAT UNTIL (y = 3)
{ {
DISPLAY (x + “ “ + y) y ← y + 1
y ← y + 1 DISPLAY (x + “ “ + y)
} }
x ← x + 1 x ← x + 1
} }
(B) (D)
x ← 0 x ← 0
REPEAT UNTIL (x = 3) REPEAT UNTIL (x = 3)
{ {
y ← x y ← x
REPEAT UNTIL (y = 3) REPEAT UNTIL (y = 3)
{ {
y ← y + 1 DISPLAY (x + “ “ + y)
DISPLAY (x + “ “ + y) y ← y + 1
} x ← x + 1
x ← x + 1 }
} }
x ← 0
REPEAT UNTIL (x = 3)
{
y ← x
REPEAT UNTIL (y = 3)
{
DISPLAY (x + “ “ + y)
y ← y + 1
}
x ← x + 1
}
18 | Practice Test 4
Section I
19. The results of an online survey are automatically put into a spreadsheet. The survey is being used to find out the respondents’
favorite candy by age group and state they live in. Here are the questions that are asked.
Which of the following data pieces will most likely need to be cleaned the most?
(A) Name
(B) Age
(C) State
(D) Favorite Candy
21. Which of the following is an example of data mining being used to discriminate against a group of individuals?
(A) Supermarkets use data mining from purchase history to determine what products they should group together at the store.
(B) Medical professionals want to analyze large data sets of patient information to determine which patients would be the
best candidates for different treatments.
(C) Credit card companies use predictive analytics to determine what demographic of people will most likely have worse
credit scores and need to be charged higher interest rates.
(D) Social media sites use search history to help predict what websites someone will want to see.
22. A board game developer wants to see each player’s chances of winning a game since the player who goes first might have an
advantage. In order to do this, the developer must run over one thousand simulations.
The game deals with a spinner that has 6 numbers on it, and all players will spin and move around the board. The players will
not make any decisions, just move around the board the entire game. Which of the possible simulations will be the MOST
efficient and cost-effective way to test out each player’s chances of winning the game?
(A) Have a person play the game by hand one thousand times, keeping track of which player wins each game.
(B) Use a random number generator to have a person manually play the game, keeping track of which player wins each
game.
(C) Create an online simulator that runs through the game over a thousand times using random spins, keeping track of which
player wins each game.
(D) Hire 10 testers to play the game 100 times each, and track which player wins each game.
Practice Test 4 | 19
Section I
23. A group of students is allowing a researcher to track the amount of time they spend on their smartphones throughout the day.
The goal is to prove that smartphone use does not correlate with student success. The following data sets have been received
by the researcher about each student:
• Amount of time spent on their phones each day
• Current GPA
• Social media sites used
Which of the following information should also be requested by the researcher in order to attempt to disprove a causal
relationship between smartphone use and student success?
(A) The student’s geolocations throughout the day
(B) If the student is using their smartphone for academic purposes
(C) How much time during the weekends the student uses their phones
(D) The financial and scholarship records from each student
24. The following procedure is intended to return true if all the values in myList increase the entire time. For example,
if myList contains [0, 1, 2, 3], the values are increasing. If myList contains [0, 4, 4, 6], they are not increasing the
entire time.
PROCEDURE isIncreasing(myList)
{
increasing ← false
prev ← 0
FOR EACH item IN myList
{
IF(prev < item)
increasing = true
ELSE
increasing = false
prev = item
}
RETURN(increasing)
}
Which of the following values for myList can be used to show that this code segment does not work as intended?
(A) [1, 2, 4, 6]
(B) [1, 4, 2, 6]
(C) [1, 2, 6, 4]
(D) [1, 2, 4, 4]
20 | Practice Test 4
Section I
25. Every character has a corresponding ASCII key code. For example, the letter “K” has the corresponding ASCII key code of
75. Each letter is broken down into their ASCII key code in decimal (base 10) and then converted to binary (base 2). Here is a
table of ASCII key codes:
26. The Internet protocol suite is a functional criteria-based framework for organizing the set of communication protocols used in
computer networks. Which of the following is NOT a foundational protocol in the suite?
(A) TCP
(B) UDP
(C) HTTP
(D) IP
Practice Test 4 | 21
Section I
27. Bradley wants to have a program that will determine what days he is supposed to work out and what days he is taking a day
off. Bradley only wants to work out on odd numbered days of the month, and he takes weekends (Saturday and Sunday) off.
There are two variables. One is an integer called day that stores the day of the month. The other variable is a string called
week that stores the day of the week (e.g., “Friday,” “Saturday”).
Which of the following code segments would NOT correctly output if Bradley should be working out or taking the day off?
(A) var dayOdd = day MOD 2 (C) var dayOdd = day MOD 2
IF (dayOdd = 0) IF (dayODD = 0 OR week = “Saturday”
DISPLAY(“Day Off”) OR week = “Sunday”)
ELSE IF (week = “Saturday” OR week DISPLAY (“Day Off”)
= “Sunday”) ELSE
DISPLAY (“Day Off”) DISPLAY (“Workout”)
ELSE
DISPLAY (“Workout”)
(B) var dayOdd = day MOD 2 (D) var dayOdd = day MOD 2
IF (dayOdd = 0 AND week = IF (dayODD = 1 AND (week ≠
“Saturday” AND week = “Sunday”) “Saturday” AND week ≠ “Sunday”))
DISPLAY (“Day Off”) DISPLAY (“Workout”)
ELSE ELSE
DISPLAY (“Workout”) DISPLAY (“Day Off”)
28. A bank needs to create a program to allow its customers to make deposits and withdrawals and print out a bank statement for
each such transaction. Which of the following would be a good use of abstraction to manage the complexity of the program?
(A) Subtracting a fee from the customer’s account every time they withdraw money
(B) Creating a loop that will continue until the customer is done depositing and withdrawing money
(C) Creating a procedure that will print out the customers bank statement that can be used multiple times throughout the
program
(D) Checking to make sure the customers have enough money whenever they withdraw money, and then subtracting the
amount withdrawn from their account
29. In order for drivers’ education students to practice driving safely, a company created a driving simulation program. While the
simulator does not have all of the typical controls of a car or move the driver physically around, it still simulates a driving
situation around real streets. Which of the following would be the LEAST likely advantage to using this software?
(A) A driving simulator can let the user know how it physically feels to get into an accident.
(B) A driving simulator can help the user learn how to drive in traffic.
(C) A driving simulator can show the user when to use turn signals.
(D) A driving simulator can help the user learn how to follow all appropriate road signs.
22 | Practice Test 4
Section I
30. Which of the following is NOT a benefit of parallel computing as opposed to using sequential computing?
(A) Parallel computing will solve larger problems that can be broken into smaller problems that do not need to be solved in a
specific order significantly more quickly than sequential computing.
(B) With problems that fluctuate between being small or large, parallel computing makes it much easier to scale no matter
the size of the problem.
(C) If a problem can be broken into smaller problems, but those smaller problems have to be solved in order, you can still use
parallel computing because it can solve the problem more quickly.
(D) Some problems may require algorithms that cannot be solved in a reasonable amount of time using sequential
computing, but may be solved in a reasonable amount of time using parallel computing.
31. Which of the following would NOT be a harmful effect on society, culture, or economy caused by using solar panels that
harness energy on a large scale?
(A) The amount of land being used by a large number of solar panels could degrade the environment and possibly the habitat
of plants or animals living there.
(B) The renewable energy will create less of a need for energy from other sources that cause major environmental issues.
(C) A tremendous amount of water is needed to produce solar panels, so their manufacturers could drain local water
resources.
(D) Solar panel production requires manufacturers and their workers to handle toxic chemicals.
32. Which of the following would do the LEAST to lessen the digital divide in a school?
(A) A school purchasing devices for all the students to use in and out of school
(B) Training all parents on how to use their child’s devices to monitor their academic success
(C) Not assigning homework that would require an Internet connection at home
(D) Allowing students to bring in their own personal devices for their online schoolwork
33. A manager of a shop is trying to disseminate information about wait times for their customers. Each time a customer shows
up, they sign in, get added to a queue, and wait to be helped. What would be the greatest advantage of using a list to store each
customer’s time they signed in and the time they were helped, as opposed to just using several independent variables?
(A) The ability to print out each user’s sign-in time and the time they were helped at the end of the day
(B) The ability to find the average wait time
(C) The ability to find the longest and shortest wait times
(D) The ability to print out the total number of customers that day
Practice Test 4 | 23
Section I
34. The following code segment is intended to store the maximum temperature of three days into the variable max. All three
variables are integers. The code segment does not work for all cases.
max ← 0
IF (day1 > max)
max = day1
IF (day2 > max)
max = day2
IF (day3 > max)
max = day3
For which of the following values for day1, day2, and day3 would this code segment not work correctly?
(A) day1 = 50, day2 = 70, day3 = 30
(B) day1 = 30, day2 = 30, day3 = 30
(C) day1 = –40, day2 = –20, day3 = –30
(D) day1 = 0, day2 = 20, day3 = 40
35. Which of the following lines of code should be turned into a procedure in order to reuse duplicated code to help manage the
complexity of the program?
Line 1: IF (CAN_MOVE(forward))
Line 2: {
Line 3: MOVE_FORWARD()
Line 4: ROTATE_LEFT()
Line 5: ROTATE_LEFT()
Line 6: }
Line 7: ELSE
Line 8: {
Line 9: ROTATE_LEFT()
Line 10: ROTATE_LEFT()
Line 11: MOVE_FORWARD()
Line 12: MOVE_FORWARD()
Line 13: }
Line 14: ROTATE_LEFT()
(A) Create a procedure called turnLeftTwice(), and use it to replace lines 4 and 5, and to replace lines 9 and 10.
(B) Create a procedure called moving(), and use it to replace lines 3–5, and lines 9–12.
(C) Create a procedure called cantMove(), and use it to replace lines 9–12.
(D) Create a procedure called moveForwardTwice(), and use it to replace lines 11 and 12.
36. Which of the following are some advantages of using a lossy compression algorithm?
I. Using a lossy compression algorithm can greatly reduce the size of a file.
II. Using a lossy compression algorithm can ensure that the quality will not be reduced.
III. Using a lossy compression algorithm makes it quicker to send and store files.
(A) I only
(B) III only
(C) I and III only
(D) II and III only
24 | Practice Test 4
Section I
37. The code segment is supposed to take the list fullList and add all the values that are larger than largeNum to the list
newList. The numbers do not need to be removed from fullList. All we want is newList to contain all the numbers
larger than largeNum.
For example, if fullList contains [10, 20, 5, 25, 30, 15], and largeNum = 13, then newList should contain
[20, 25, 30, 15] after running the code.
1 ← index
FOR EACH item IN fullList
{
<missing code>
}
Which of the following code segments would make the code work as wanted?
(A) IF (item < largeNum) (C) IF (item > largeNum)
{ {
INSERT(newList,index,item) INSERT(newList,index,item)
index ← index + 1 }
}
Practice Test 4 | 25
Section I
38. The following grid contains a robot represented as a triangle. The robot is initially facing up, and the robot ends in the same
location facing up.
This example works for a robot that is moving three squares in each direction. We want to make it so the procedure takes one
argument that will determine the number of squares in each direction the robot will go to make the square.
Which of the following code segments can be used to move the robot so it starts and finishes in the same location, facing the
same direction, making a square the correct size?
(A) (C)
PROCEDURE makeSquare(sideLength) PROCEDURE makeSquare(sideLength)
{ {
REPEAT sideLength TIMES REPEAT 4 TIMES
{ {
REPEAT sideLength TIMES REPEAT sideLength TIMES
{ {
MOVE_FORWARD() MOVE_FORWARD()
} ROTATE_LEFT()
ROTATE_LEFT() }
} }
} }
(B) (D)
PROCEDURE makeSquare(sideLength) PROCEDURE makeSquare(sideLength)
{ {
REPEAT 4 TIMES REPEAT 4 TIMES
{ {
MOVE_FORWARD() REPEAT sideLength TIMES
MOVE_FORWARD() {
MOVE_FORWARD() MOVE_FORWARD()
ROTATE_LEFT() }
} ROTATE_LEFT()
} }
}
26 | Practice Test 4
Section I
Beth is writing a program that will create work groups in a class that she teaches. She wants to establish groups that work
with an assignment about the digital divide. The students are going to write a paper on how the digital divide creates unfair
disadvantages for different students. She wants each group to have students who can contribute their own personal experiences
with the digital divide.
Once Beth enters every students’ information into the program, it will create groups with even numbers of students.
39. Which of the following data input(s) are going to be necessary to complete this program?
I. Each student’s list of friends in the class
II. Each student’s socioeconomic status
III. Every student’s access to the Internet at home
(A) II only
(B) I and II only
(C) II and III only
(D) I, II and III
40. Which of the following strategies would LEAST assist in creating a collaborative group environment for them to write a
research paper on the digital divide?
(A) Have each student independently write a research paper, then combine their papers into one larger document.
(B) Have the students discuss their own experiences with the digital divide, and use that as a starting point to their research.
(C) Have each student research articles, then have everyone read the articles together and discuss.
(D) Have the group come up with an outline of the project together in a shared document.
Practice Test 4 | 27
Section I
41. The following grid contains a robot represented as a triangle. The robot is initially the black triangle in the bottom left corner
facing up. The robot needs to end up as the other triangle in the top right corner facing down.
Which of the following changes needs to be made to fix the following code?
Line 1: REPEAT 2 TIMES
Line 2: {
Line 3: REPEAT 4 TIMES
Line 4: {
Line 5: MOVE_FORWARD()
Line 6: TURN_RIGHT()
Line 7: }
Line 8: }
(A) Change Line 1 to REPEAT 4 TIMES
(B) Move Line 6 after Line 7
(C) Switch Line 5 and Line 6
(D) Move Line 6 after Line 8
42. A group of high school students from the same school all have similar demographics. This group is asked to fill out a survey
that has different types of poll questions. The group administering the survey is not sure of the number of students who will
participate, so the data analyzation must be scalable for all sizes. The school cannot require the students to take the survey, so
as few as five students may take the survey, or as many as 2,000 students may take the survey.
Which of the following is LEAST likely to cause an issue when trying to fairly analyze the data without bias or having to
spend too much time cleaning the data?
(A) The data set from the questions with two and four options will be too large to analyze.
(B) The data will need to be cleaned too much, especially write-in answers.
(C) The data will have bias since everyone is from similar demographics.
(D) The data will be incomplete if there are too few students answering the poll.
28 | Practice Test 4
Section I
44. A high school is holding an election for class president. There are two candidates running for office. Candidate A excels in
all his classes and is in several clubs. Candidate B excels in athletics and music but struggles in academics. The entire school
votes, and every student’s vote is tracked in a data file.
The school has a second data file that contains every student’s GPA, attendance record, and demographics. In addition to that,
the second data file also contains which clubs, athletics, and music programs each student is involved in.
The stats class wants to combine both data sets and try to find as many correlations as they can between whom the students
voted for and information about the students. Using what we know about the two candidates, what filter would be LEAST
important to use when trying to find a correlation?
(A) Create a filter to compare the votes and each student’s GPA to look for a correlation.
(B) Create a filter to compare the students who are in the same clubs as candidate A and what percent of them voted for
candidate A.
(C) Create a filter to compare the students who are in the same athletics as candidate B and what percent of them voted for
candidate B.
(D) Create a filter that compares the attendance records of each student and who they voted for.
45. The following code segment is intended to store all the prime numbers that are between the numbers 1 and 20, inclusively,
in the list primeList. The program currently has a procedure called prime(number), which will receive a single
parameter, and return true if that number is prime, false otherwise.
Which of the following can be used to replace <missing code> so that the code segment works as intended?
Practice Test 4 | 29
Section I
46. Upon completion of the following code segment, what would be printed out?
a ← 10
b ← 15
c ← a
a ← 20
c ← b
DISPLAY (a)
DISPLAY (c)
(A) 10 10
(B) 10 15
(C) 20 10
(D) 20 15
47. During an upcoming election, a social media site is accused of presenting bias toward one of the candidates. What adjustments
can be made to the site that will be MOST effective for eliminating bias in their algorithms?
(A) Only show users news articles that may be favorable to whomever they are interested in voting for.
(B) Censor all information that might be questionable without checking the information, just to be sure that nothing gets
posted that is untrue.
(C) Ensure that the search algorithms do not favor one candidate over another and show an equal amount of information
about both candidates.
(D) Create an algorithm that will use the previously searched information to guide a user towards a candidate.
48. Which of the following will swap the values of larger and smaller only if larger is less than smaller?
For example, if larger = 10 and smaller = 20, then the program should swap the two values since smaller is
greater than larger. Therefore, larger = 20 and smaller = 10 at the end of the code segment.
(A) (C)
IF larger > smaller IF larger < smaller
(B) (D)
IF larger < smaller IF larger < smaller
30 | Practice Test 4
Section I
49. An RGB triplet is a combination of three values that form a color, in the order of (red, green, blue). The decimal value of
golden brown as an RGB triplet is (153, 101, 21). What would be the correct RGB value using binary?
(A) (1001 1001, 0110 0101, 0001 0101)
(B) (1101 1001, 1100 0101, 0000 1101)
(C) (1101 1001, 0110 0101, 0000 1101)
(D) (1001 1001, 1100 0101, 0001 0101)
50. The following procedure is supposed to return the number of items in myList that are between min and max, inclusively.
1 PROCEDURE countBetween(myList, min, max)
2 {
3 counter ← 0
4 FOR EACH item IN myList
5 {
6 IF(item ≥ min OR item ≤ max)
7 counter ← counter + 1
8 }
9 RETURN(counter)
10 }
The procedure does not work as intended. What change needs to be made so the procedures will work as intended?
(A) Switch Line 3 so it is inside the loop, right after line 5
(B) Switch Line 9 into the loop, right after Line 7
(C) Change Line 6 to IF(item = min OR item = max)
(D) Change the OR in Line 6 to AND
51. Which of the following is a legal way to use materials you have found on the Internet?
(A) The material does not have the © for copyright anywhere on it, so it is freely available for anyone to use.
(B) When using only a small part of an online text, you do not have to ask permission, even if that small part is the most
important part.
(C) Any work on the Internet is automatically public domain and can be used in any way.
(D) Anyone can use open source materials for which the rights for reproduction have been waived by the owner.
52. What is the LEAST concerning issue with putting your Personally Identifiable Information online?
(A) Your geolocation can be used by someone to find you at any time.
(B) Your browsing history can be used for targeted marking.
(C) Your social security number online can be used to steal your identity.
(D) Your geolocation can be used to commit a crime against someone if their location is always known.
53. Which of the following would properly perform a binary search, and what would be the maximum amount of searches needed
to find an element on the list using a binary search?
(A) Searching for a name through a list of 50 names and ID numbers that are stored alphabetically. Using a binary search to
find a name in this list would take a maximum of 6 searches.
(B) Searching for an ID number through a list of 50 names and ID numbers that are stored alphabetically. Using a binary
search, this would take a maximum of 6 searches.
(C) Searching for an account number through a list of 100 account numbers that are stored from least to greatest. Using a
binary search, this would take a maximum of 10 searches.
(D) Searching for an account number through an unsorted list of 100 account numbers. Using a binary search, this would
take a maximum of 7 searches.
Practice Test 4 | 31
Section I
54. A list of names has n elements, indexed from 1 to n. A program needs to go through the entire list and find all the occurrences
of the name “Jenny”. The program would start by creating a variable called counter, and setting it to 0. Then it would
create a variable called position, and set it to 1.
Which of the following algorithms would properly count all the occurrences of “Jenny” in the list, and print out the number
of times it appears after the program is done counting?
(A) Step 1: If the value of index position in list equals “Jenny”, increment counter by 1.
Step 2: Repeat Step 1
Step 3: Display counter
(B) Step 1: If the value of index position in list equals “Jenny”, increment position by 1.
Step 2: Increment position by 1.
Step 3: Repeat Step 2
Step 4: Display position
(C) Step 1: If the value of index position in list equals “Jenny”, increment counter by 1.
Step 2: Increment position by 1.
Step 3: Repeat Step 1
Step 4: Display counter
(D) Step 1: If the value of index position in list equals “Jenny”, increment counter by 1.
Step 2: Increment position by 1.
Step 3: Display counter
Step 4: Repeat Step 2
55. A company wants to run a website that stores pictures for users and hires a programmer to create it. The programmer is told
that the website will be a low-cost alternative to more expensive websites, so they want the programmer to find the cheapest
ways to upload, store, and download the images without losing quality.
Which of the following would be good examples of ways to keep the cost down?
I. Store all the pictures without any compression since that is the only way they will not lose any quality.
II. Make all the images lossy since it will be quicker to download them from the site.
III. Make all the images lossy, but make sure you do not lose any quality that would be visible to the human eye when
uploading and downloading them.
(A) I only
(B) II only
(C) I and II only
(D) II and III only
32 | Practice Test 4
Section I
56. The figure below represents a network of physically linked devices. Any line that is drawn between two devices means they
are connected. A device can communicate with any other device through these connections.
B
A
C
G E
H
D
F
57. Which of the following would be the MOST appropriate citizen science project, and why?
(A) Have non-scientists request people from different regions to track animals throughout the wild to see where they migrate
during certain seasons
(B) A group of scientists requesting people from different regions take pictures of the sky at night, sending the pictures to
them, and then having the scientists analyze light pollution from these regions
(C) Have people from different regions purchase science kits and analyze water samples in their kitchen, and then analyze
their data individually
(D) A not-for-profit group having users download an app that tracks users as they go about their day. They use this data as
open source to show where people frequently visit in different locations
Practice Test 4 | 33
Section I
One popular encryption method is to shift the letters by a fixed amount. For instance, if the string “OHIO” is shifted by three let-
ters, the resulting string would be “RKLR”. In this instance, the letter “X” would shift to “A”, the letter “Y” to “B”, and the letter
“Z” to “C”. An organization wants to add this layer of encryption to all its internal communications. The organization’s program-
mers have written a method to encrypt the organization’s messages. A flowchart of the encryption process is provided below:
Start
Input: i ← 1
inString outString ← Empty String
offset
False
True
c ← c + offset 65 < c < 90
False
Append character of
ASCII code c to outString
i ← i + 1
34 | Practice Test 4
Section I
Assume all communication at this organization is in uppercase and offset is a small positive integer. ASCII to decimal conver-
sion is provided for reference:
(A) The encryption process will not work as intended because there will be no systematic way to decrypt the encrypted text.
(B) The encryption process will not work as intended because the last few letters (determined by the value of offset) will
not be properly encrypted.
(C) The encryption process will not work as intended because the first few letters (determined by the value of offset) will
not be properly encrypted.
(D) The encryption process will work as intended.
(A) A new process for decryption is needed as the encryption process cannot be used.
(B) Run the same process on the encoded message.
(C) Run the same process on the encoded message but use the negative of offset.
(D) Run the same process on the encoded message but offset the by adding characters either to the beginning or the end of
the message.
Practice Test 4 | 35
Section I
True
c ← c + offset 65 < c < 90
False
i ← i + 1
62. The message “CALL ME” was encrypted using the process above and an offset of 3. Which one of the following is the cor-
rect encrypted message?
(A) “ZXII JB” with offset = +3
(B) “ZXII JB” with offset = –3
(C) “FCOO PH” with offset = +3
(D) “FCOO PH” with offset = –3
36 | Practice Test 4
Section I
63. Which of the following actions can help bridge the digital divide for people with disabilities?
64. What are some examples that would make a system fault-tolerant?
65. Which of the following tasks would require a heuristic approach to solving a problem?
Practice Test 4 | 37
Section I
68. A board game has a spinner that has 8 different, evenly spaced numbers on it. The spinner looks like the following.
8 1
7 2
6 3
5 4
Example 1: If the player spins a 5 on their first spin, the score returned is 5.
Example 2: If the player spins an 8 on their first spin, the players gets a second spin. If the player spins a 3 on the
second spin, the score returned is 3 times 10, which is 30.
The procedure game() was created to return the correct value from the spin(s).
PROCEDURE game()
{
spin1 ← RANDOM(1,8)
<missing code>
}
Which of the following can be used to replace <missing code> so that the code segment works as intended?
38 | Practice Test 4
Section I
69. The price of going to a local water park depends on a person’s age and if they have a coupon or not. A person’s age will be
stored as the variable age and will be an integer. If the person has a coupon, it will be stored as a Boolean coupon, which is
true if they have the coupon, false otherwise.
If a person is under the age of 6, they do not pay to go to the water park. If they are 6 years old or older, they are charged $10.
If they have a coupon, they are charged half.
Which of the following code segments correctly sets the value of cost?
cost = 5 cost = 0
ELSE ELSE
cost = 10 cost = 10
cost = 5 cost = 10
Practice Test 4 | 39
Section I
70. A teacher gives out three grades, “Exceeds” if a score is 90 or above, “Meets” if a score is greater than or equal to 70, but
lower than 90, or “Does not meet” if a score is below 70. Which of the following would work for these specifications?
(A) (C)
IF score ≥ 90 IF score ≥ 90
(B) (D)
IF score ≥ 90 IF score ≥ 90
STOP
END OF EXAM
40 | Practice Test 4