AP Computer Science Practice Test 4 Interactive
AP Computer Science Practice Test 4 Interactive
ss the interactiv
NOTE: To acce
is PDF, please
functions of th d
have downloade
make sure you
of Adobe
the free version
here:
Acrobat Reader
.com/reader/
https://get.adobe
Practice Test 4
NEXT
Section I: Multiple Choice
BACK NEXT
2 | Practice Test 4
Section I: Multiple Choice
12
11 B x ← 11
y ← 1
10 REPEAT 4 TIMES
9 {
drawRectangle(x, y, x+3, y+7)
8 x ← x + 3
7 y ← y + 2
6 }
5
4 C x ← 10
3 y ← 5
2 REPEAT 4 TIMES
{
1 drawRectangle(x, y, x+2, y-4)
x ← x - 3
0 y ← y + 2
1 2 3 4 5 6 7 8 9 10 11 12 }
D x ← 10
y ← 5
REPEAT 4 TIMES
{
drawRectangle(x, y, x+2, y+4)
x ← x - 3
y ← y + 2
}
BACK NEXT
Practice Test 5 | 3
Section I: Multiple Choice
x ← 10
2 Mark for Review
y ← 20
IF (x < 15) What would be stored at x upon completion of the following code segment?
{
IF (y < 20) A 10
x ← x - 10
ELSE
x ← x + 10 B 20
}
IF (x > 15) C 25
x ← x + 5
D 30
BACK NEXT
4 | Practice Test 5
Section I: Multiple Choice
A concert is selling tickets online only for an upcoming show. The management is 3 Mark for Review
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. Using the metadata given to us, which of the following CANNOT be analyzed to help
determine future ticket prices?
• The time and the seat location of each ticket purchased
• The name and age of the purchaser A The seat locations of tickets that sold the fastest
• The geolocation of the purchaser
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
BACK NEXT
Practice Test 5 | 5
Section I: Multiple Choice
The following storyboard is used to create a password system. 4 Mark for Review
Which of the following code segments works correctly for this storyboard?
Employee prompted Employee types
Start A PROCEDURE correctPassword(password)
for password in password
{
counter ← 0
REPEAT UNTIL (counter = 3)
Compares user {
true inputted password to false
DISPLAY(“Enter the password:”)
password received as pw ← INPUT
parameter IF (password = pw)
RETURN(true)
Procedure Increment }
returns true counter }
true false
if counter = 3 B PROCEDURE correctPassword(password)
{
counter = false
Procedure
REPEAT 3 TIMES
returns false
{
DISPLAY(“Enter the password:”)
pw ← INPUT
IF (password = pw)
correct = true
ELSE
correct = false
}
RETURN(correct)
}
BACK NEXT
6 | Practice Test 5
Section I: Multiple Choice
C PROCEDURE correctPassword(password)
{
counter ← 0
REPEAT UNTIL (counter = 3)
{
DISPLAY(“Enter the password:”)
pw ← INPUT
IF (password = pw)
RETURN(true)
ELSE
counter ← counter + 1
}
RETURN(false)
}
D PROCEDURE correctPassword(password)
{
counter = false
REPEAT 3 TIMES
{
DISPLAY(“Enter the password:”)
pw ← INPUT
IF (password = pw)
RETURN(true)
ELSE
RETURN(false)
}
}
BACK NEXT
Practice Test 5 | 7
Section I: Multiple Choice
A Create an algorithm that will solve one of the possible solutions, but will not solve all of
the possible solutions.
B Prove that there exists a solution to the problem that has no possible algorithm to solve it.
C Create an algorithm that will solve the problem in a reasonable amount of time.
D Prove that there exists an algorithm to solve the problem, but it cannot solve the problem
in a reasonable amount of time.
8 | Practice Test 5
Section I: Multiple Choice
A A truncating error
B A rounding error
C An overflow error
D An addition error
Practice Test 5 | 9
Section I: Multiple Choice
B 4
C 24
D 32
10 | Practice Test 5
Section I: Multiple Choice
A I only
B I and II only
Practice Test 5 | 11
Section I: Multiple Choice
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
12 | Practice Test 5
Section I: Multiple Choice
A 63
B 8
C 3
D 2
Practice Test 5 | 13
Section I: Multiple Choice
A Packet-filtering firewall
B Proxy firewall
14 | Practice Test 5
Section I: Multiple Choice
The following list myList contains all integers. 12 Mark for Review
PROCEDURE changeList(myList) Which of the following best describes how this code segment works?
counter ← 1
REPEAT UNTIL (counter > LENGTH(myList)) A The code segment will replace all negative indexes in myList with 0 and
IF (myList[counter] < 0) return mylist.
myList[counter] = 0
counter ← counter + 1
B The code segment will have an error since it will go out of bounds on
RETURN(myList)
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.
Practice Test 5 | 15
Section I: Multiple Choice
A 2
B 3
C 5
D 5.6
16 | Practice Test 5
Section I: Multiple Choice
A large spreadsheet contains the following data about a company. Here is a small 14 Mark for Review
sample of what the data could look like. The top row is the header.
Which of the following would be the most efficient way to find all the employees that
Number should be promoted?
Name Job Title Revenue Expenses
of Years
“Stanford” 25 “Manager” 1000 500 A Filter out all employees with the Job Title “Manager”
Sort by Revenue
“Kathy” 22 “Manager” 1500 250
Sort by Number of Years
“Mike” 8 “Sales” 2000 1500
“Beth” 5 “Sales” 500 1750
B Sort by Job Title
“Brian” 3 “Sales” 1000 1200 Sort by Number of Years
“Jacob” 4 “Sales” 700 500 Create another column with the formula (Revenue − Expenses)
The company has to figure out which employees with the job title “Sales” need to be Filter out all employees with a value 0 or lower in the new column
promoted to “Manager.” In order to be promoted, an employee must fit the following
criteria. C Manually remove all employees with the Job Title “Manager”
• Be an employee of 5 or more years Manually remove all employees with Number of Years less than 5
• Have a job title of “Sales” Create another column with the formula (Revenue − Expenses)
Manually remove all numbers less than or equal to 0 from the new
• Have their revenue exceed their expenses
column
Practice Test 5 | 17
Section I: Multiple Choice
Computer A uses sequential computing and has one processor. Computer B uses 15 Mark for Review
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 How much longer will it take Computer A to run the three processes than it will take
different processors. Computer B?
There are three processes that need to be run, and they can be run in any order. One
A Same amount of time
of the processes takes 10 minutes, one of the processes takes 15 minutes, and the final
process takes 22 minutes.
B 3 minutes
C 22 minutes
D 25 minutes
BACK NEXT
18 | Practice Test 5
Section I: Multiple Choice
There are currently twenty employees at a store. The store is planning on opening up 16 Mark for Review
four new locations, each of which will have twenty employees. This means that the
company will now have 100 employees. 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
Currently, each employee has an ID number that is only five bits long and contains
extra bits?
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,
A 0
without wasting any extra bits?
B 1
C 2
D 3
BACK NEXT
Practice Test 5 | 19
Section I: Multiple Choice
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.
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.
20 | Practice Test 5
Section I: Multiple Choice
Practice Test 5 | 21
Section I: Multiple Choice Section I: Multiple Choice
0 0
18 Mark for Review
0 1
0 2 Which of the code segments would produce the following output?
1 1 A x ← 0
1 2 REPEAT UNTIL (x = 3)
2 2 {
y ← x
REPEAT UNTIL (y = 3)
{
DISPLAY (x + “ “ + y)
y ← y + 1
}
x ← x + 1
}
B x ← 0
REPEAT UNTIL (x = 3)
{
y ← x
REPEAT UNTIL (y = 3)
{
y ← y + 1
DISPLAY (x + “ “ + y)
}
x ← x + 1
}
BACK NEXT
22 | Practice Test 5
Section I: Multiple Choice
C x ← 0
y ← 0
REPEAT UNTIL (x = 3)
{
y ← x
REPEAT UNTIL (y = 3)
{
y ← y + 1
DISPLAY (x + “ “ + y)
}
x ← x + 1
}
D x ← 0
REPEAT UNTIL (x = 3)
{
y ← x
REPEAT UNTIL (y = 3)
{
DISPLAY (x + “ “ + y)
y ← y + 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
}
BACK NEXT
Practice Test 5 | 23
Section I: Multiple Choice
The results of an online survey are automatically put into a spreadsheet. The survey is 19 Mark for Review
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?
C State
D Favorite Candy
24 | Practice Test 5
Section I: Multiple Choice
A FTP
B IMAP
C POP3
D SMTP
Practice Test 5 | 25
Section I: Multiple Choice
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.
26 | Practice Test 5
Section I: Multiple Choice
A board game developer wants to see each player’s chances of winning a game since 22 Mark for Review
the player who goes first might have an advantage. In order to do this, the developer
must run over one thousand simulations. 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?
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
A Have a person play the game by hand one thousand times, keeping track
board the entire game.
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 5 | 27
Section I: Multiple Choice
A group of students is allowing a researcher to track the amount of time they spend on 23 Mark for Review
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 Which of the following information should also be requested by the researcher in
researcher about each student: order to attempt to disprove a causal relationship between smartphone use and student
success?
• Amount of time spent on their phones each day
• Current GPA A The student’s geolocations throughout the day
• Social media sites used
B If the student is using their smartphone for academic purposes
C How much time during the weekends the student uses their phones
BACK NEXT
28 | Practice Test 5
Section I: Multiple Choice
The following procedure is intended to return true if all the values in myList 24 Mark for Review
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. Which of the following values for myList can be used to show that this code segment
does not work as intended?
PROCEDURE isIncreasing(myList)
{
A [1, 2, 4, 6]
increasing ← false
prev ← 0
FOR EACH item IN myList B [1, 4, 2, 6]
{
IF(prev < item)
increasing = true C [1, 2, 6, 4]
ELSE
increasing = false
prev = item D [1, 2, 4, 4]
}
RETURN(increasing)
}
BACK NEXT
Practice Test 5 | 29
Section I: Multiple Choice
Every character has a corresponding ASCII key code. For example, the letter “K” has 25 Mark for Review
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 Which of the following would be the binary representation of “HEY”?
ASCII key codes:
A 0100 1000 0100 0101 0101 1001
Decimal ASCII Decimal ASCII
65 A 78 N B 0110 1000 0110 0101 0111 1001
66 B 79 O
C 0001 0010 1010 0010 1001 1010
67 C 80 P
68 D 81 Q
D 0100 1001 0100 0110 0101 1010
69 E 82 R
70 F 83 S
71 G 84 T
72 H 85 U
73 I 86 V
74 J 87 W
75 K 88 X
76 L 89 Y
77 M 90 Z
30 | Practice Test 5
Section I: Multiple Choice
A TCP
B UDP
C HTTP
D IP
Practice Test 5 | 31
Section I: Multiple Choice
Bradley wants to have a program that will determine what days he is supposed to 27 Mark for Review
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. Which of the following code segments would NOT correctly output if Bradley should
be working out or taking the day 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.,
A var dayOdd = day MOD 2
“Friday,” “Saturday”). IF (dayOdd = 0)
DISPLAY(“Day Off”)
ELSE IF (week = “Saturday” OR week = “Sunday”)
DISPLAY (“Day Off”)
ELSE
DISPLAY (“Workout”)
32 | Practice Test 5
Section I: Multiple Choice
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
Practice Test 5 | 33
Section I: Multiple Choice
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.
34 | Practice Test 5
Section I: Multiple Choice
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.
Practice Test 5 | 35
Section I: Multiple Choice
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.
D Solar panel production requires manufacturers and their workers to handle toxic
chemicals.
36 | Practice Test 5
Section I: Multiple Choice
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
D Allowing students to bring in their own personal devices for their online schoolwork
Practice Test 5 | 37
Section I: Multiple Choice
A The ability to print out each user’s sign-in time and the time they were helped at the end
of the day
D The ability to print out the total number of customers that day
38 | Practice Test 5
Section I: Multiple Choice
The following code segment is intended to store the maximum temperature of three 34 Mark for Review
days into the variable max. All three variables are integers. The code segment does not
work for all cases. For which of the following values for day1, day2, and day3 would this code segment
not work correctly?
max ← 0
IF (day1 > max)
A day1 = 50, day2 = 70, day3 = 30
max = day1
IF (day2 > max)
max = day2 B day1 = 30, day2 = 30, day3 = 30
IF (day3 > max)
max = day3
C day1 = –40, day2 = –20, day3 = –30
Practice Test 5 | 39
Section I: Multiple Choice
Line 1: IF (CAN_MOVE(forward))
35 Mark for Review
Line 2: {
Line 3: MOVE_FORWARD() Which of the following lines of code should be turned into a procedure in order to
Line 4: ROTATE_LEFT() reuse duplicated code to help manage the complexity of the program?
Line 5: ROTATE_LEFT()
Line 6: } A Create a procedure called turnLeftTwice(), and use it to replace
Line 7: ELSE lines 4 and 5, and to replace lines 9 and 10.
Line 8: {
Line 9: ROTATE_LEFT()
Line 10: ROTATE_LEFT() B Create a procedure called moving(), and use it to replace lines 3–5,
Line 11: MOVE_FORWARD() and lines 9–12.
Line 12: MOVE_FORWARD()
Line 13: }
Line 14: ROTATE_LEFT() C Create a procedure called cantMove(), and use it to replace lines
9–12.
40 | Practice Test 5
Section I: Multiple Choice
A I only
B III only
Practice Test 5 | 41
Section I: Multiple Choice
The code segment is supposed to take the list fullList and add all the values that 37 Mark for Review
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 Which of the following code segments would make the code work as wanted?
than largeNum.
A IF (item < 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.
INSERT(newList,index,item)
1 ← index
index ← index + 1
FOR EACH item IN fullList
{ }
<missing code>
} B IF (item > largeNum)
{
INSERT(newList,index,item)
index ← index + 1
}
42 | Practice Test 5
Section I: Multiple Choice
Practice Test 5 | 43
Section I: Multiple Choice
The following grid contains a robot represented as a triangle. The robot is initially 38 Mark for Review
facing up, and the robot ends in the same location facing up.
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 PROCEDURE makeSquare(sideLength)
{
REPEAT sideLength TIMES
{
REPEAT sideLength TIMES
{
MOVE_FORWARD()
}
ROTATE_LEFT()
}
}
B PROCEDURE makeSquare(sideLength)
{
This example works for a robot that is moving three squares in each direction. We REPEAT 4 TIMES
{
want to make it so the procedure takes one argument that will determine the number MOVE_FORWARD()
of squares in each direction the robot will go to make the square. MOVE_FORWARD()
MOVE_FORWARD()
ROTATE_LEFT()
}
}
BACK NEXT
44 | Practice Test 5
Section I: Multiple Choice
C PROCEDURE makeSquare(sideLength)
{
REPEAT 4 TIMES
{
REPEAT sideLength TIMES
{
MOVE_FORWARD()
ROTATE_LEFT()
}
}
}
D PROCEDURE makeSquare(sideLength)
{
REPEAT 4 TIMES
{
REPEAT sideLength TIMES
{
MOVE_FORWARD()
}
ROTATE_LEFT()
}
}
BACK NEXT
Practice Test 5 | 45
Section I: Multiple Choice
Beth is writing a program that will create work groups in a class that she teaches. Which of the following data input(s) are going to be necessary to complete this
She wants to establish groups that work with an assignment about the digital program?
divide. The students are going to write a paper on how the digital divide creates I. Each student’s list of friends in the class
unfair disadvantages for different students. She wants each group to have students II. Each student’s socioeconomic status
who can contribute their own personal experiences with the digital divide. III. Every student’s access to the Internet at home
Once Beth enters every students’ information into the program, it will create
groups with even numbers of students.
A II only
B I and II only
D I, II and III
BACK NEXT
46 | Practice Test 5
Section I: Multiple Choice
Beth is writing a program that will create work groups in a class that she teaches. Which of the following strategies would LEAST assist in creating a collaborative group
She wants to establish groups that work with an assignment about the digital environment for them to write a research paper on the digital divide?
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 A Have each student independently write a research paper, then combine
who can contribute their own personal experiences with the digital divide. their papers into one larger document.
Once Beth enters every students’ information into the program, it will create
groups with even numbers of students. 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.
BACK NEXT
Practice Test 5 | 47
Section I: Multiple Choice
The following grid contains a robot represented as a triangle. The robot is initially the 41 Mark for Review
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: }
BACK NEXT
48 | Practice Test 5
Section I: Multiple Choice
A group of high school students from the same school all have similar demographics. 42 Mark for Review
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 Which of the following is LEAST likely to cause an issue when trying to fairly analyze
participate, so the data analyzation must be scalable for all sizes. The school cannot the data without bias or having to spend too much time cleaning the data?
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. A The data set from the questions with two and four options will be too
The survey consists of the following types of questions. large to analyze.
• Ten questions that have two options
• Ten questions that have four options B The data will need to be cleaned too much, especially write-in answers.
• Five questions where the students will write in answers to the poll questions
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.
BACK NEXT
Practice Test 5 | 49
Section I: Multiple Choice
A A picture is compressed to a much smaller size, but when it is restored it does not have
the same picture quality as the original file before it was compressed.
C A music file is compressed and loses some quality, but not any quality that makes a
difference to the human ear.
D A video is compressed since it was too large to be transmitted, but when it was restored
back to its original size, it didn’t lose anything.
50 | Practice Test 5
Section I: Multiple Choice
A high school is holding an election for class president. There are two candidates 44 Mark for Review
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 Using what we know about the two candidates, what filter would be LEAST important
school votes, and every student’s vote is tracked in a data file. to use when trying to find a correlation?
The school has a second data file that contains every student’s GPA, attendance record,
A Create a filter to compare the votes and each student’s GPA to look for a
and demographics. In addition to that, the second data file also contains which clubs,
athletics, and music programs each student is involved in. correlation.
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. 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.
Practice Test 5 | 51
Section I: Multiple Choice
The following code segment is intended to store all the prime numbers that are 45 Mark for Review
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 Which of the following can be used to replace <missing code> so that the code
parameter, and return true if that number is prime, false otherwise. segment works as intended?
C IF (prime(i))
{
i ← i + 1
APPEND(primeList, i)
}
D IF (prime(i))
{
APPEND(primeList, i)
}
i ← i + 1
BACK NEXT
52 | Practice Test 5
Section I: Multiple Choice
a ← 10
46 Mark for Review
b ← 15
c ← a Upon completion of the code segment shown, what would be printed out?
a ← 20
c ← b A 10 10
DISPLAY (a)
DISPLAY (c) B 10 15
C 20 10
D 20 15
BACK NEXT
Practice Test 5 | 53
Section I: Multiple Choice
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.
54 | Practice Test 5
Section I: Multiple Choice
A
IF larger > smaller
larger = smaller
B
IF larger < smaller
C
IF larger < smaller
larger = smaller
smaller = larger
D
IF larger < smaller
Practice Test 5 | 55
Section I: Multiple Choice
56 | Practice Test 5
Section I: Multiple Choice
The following procedure is supposed to return the number of items in myList that 50 Mark for Review
are between min and max, inclusively.
The procedure does not work as intended. What change needs to be made so the
1 PROCEDURE countBetween(myList, min, max)
procedures will work as intended?
2 {
3 counter ← 0
4 FOR EACH item IN myList
A Switch Line 3 so it is inside the loop, right after line 5
5 {
6 IF(item ≥ min OR item ≤ max) B Switch Line 9 into the loop, right after Line 7
7 counter ← counter + 1
8 }
9 RETURN(counter) C Change Line 6 to IF(item = min OR item = max)
10 }
Practice Test 5 | 57
Section I: Multiple Choice
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.
58 | Practice Test 5
Section I: Multiple Choice
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.
Practice Test 5 | 59
Section I: Multiple Choice
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.
60 | Practice Test 5
Section I: Multiple Choice
A list of names has n elements, indexed from 1 to n. A program needs to go through 54 Mark for Review
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 Which of the following algorithms would properly count all the occurrences of
variable called position, and set it to 1. “Jenny” in the list, and print out the number of times it appears after the program is
done counting?
Practice Test 5 | 61
Section I: Multiple Choice
A company wants to run a website that stores pictures for users and hires a 55 Mark for Review
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 Which of the following would be good examples of ways to keep the cost down?
cheapest ways to upload, store, and download the images without losing quality. 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
BACK NEXT
62 | Practice Test 5
Section I: Multiple Choice
The figure below represents a network of physically linked devices. Any line that is 56 Mark for Review
drawn between two devices means they are connected. A device can communicate
with any other device through these connections. Which of the following statement(s) are true about this connection?
I. If devices B and D were to fail, then device C would not be able to receive
B any data from any other device.
II. If devices C and F were to fail, then device B could not connect to device D.
A III. If devices G and E were to fail, no devices would be able to communicate
C
with each other.
G E
A I only
H
D
F B III only
C I and II only
D I, II and III
BACK NEXT
Practice Test 5 | 63
Section I: Multiple Choice
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
64 | Practice Test 5
Section I: Multiple Choice
Practice Test 5 | 65
Section I: Multiple Choice
One popular encryption method is to shift the letters by a fixed amount. For in-
stance, if the string “OHIO” is shifted by three letters, 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 programmers 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
BACK NEXT
66 | Practice Test 5
Section I: Multiple Choice
Assume all communication at this organization is in uppercase and offset is a 58 Mark for Review
small positive integer. ASCII to decimal conversion is provided for reference:
Will the encryption process work as intended?
Char Code Char Code
A 65 N 78 A The encryption process will not work as intended because there will be
B 66 O 79 no systematic way to decrypt the encrypted text.
C 67 P 80
D 68 Q 81 B The encryption process will not work as intended because the last few
E 69 R 82 letters (determined by the value of offset) will not be properly
F 70 S 83 encrypted.
G 71 T 84
H 72 U 85 C The encryption process will not work as intended because the first few
I 73 V 86 letters (determined by the value of offset) will not be properly
J 74 W 87 encrypted.
K 75 X 88
L 76 Y 89 D The encryption process will work as intended.
M 77 Z 90
BACK NEXT
Practice Test 5 | 67
Section I: Multiple Choice
One popular encryption method is to shift the letters by a fixed amount. For in-
stance, if the string “OHIO” is shifted by three letters, 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 programmers 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
BACK NEXT
68 | Practice Test 5
Section I: Multiple Choice
Assume all communication at this organization is in uppercase and offset is a 59 Mark for Review
small positive integer. ASCII to decimal conversion is provided for reference:
How would a coded message be decrypted?
Char Code Char Code
A 65 N 78 A A new process for decryption is needed as the encryption process cannot
B 66 O 79 be used.
C 67 P 80
D 68 Q 81 B Run the same process on the encoded message.
E 69 R 82
F 70 S 83 C Run the same process on the encoded message but use the negative of
G 71 T 84 offset.
H 72 U 85
I 73 V 86 D Run the same process on the encoded message but offset the by adding
J 74 W 87 characters either to the beginning or the end of the message.
K 75 X 88
L 76 Y 89
M 77 Z 90
BACK NEXT
Practice Test 5 | 69
Section I: Multiple Choice
One popular encryption method is to shift the letters by a fixed amount. For in-
stance, if the string “OHIO” is shifted by three letters, 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 programmers 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
BACK NEXT
70 | Practice Test 5
Section I: Multiple Choice
Assume all communication at this organization is in uppercase and offset is a 60 Mark for Review
small positive integer. ASCII to decimal conversion is provided for reference:
The boxed region in the flowchart above is redone as:
Char Code Char Code
A 65 N 78
B 66 O 79
True
C 67 P 80 c ← c + offset 65 < c < 90
D 68 Q 81
E 69 R 82 False
F 70 S 83
c ← ((c + offset) MOD 26) + 65) Append character of
G 71 T 84 ASCII code c to outString
H 72 U 85
I 73 V 86
i ← i + 1
J 74 W 87
K 75 X 88 Will the process work as intended?
L 76 Y 89
M 77 Z 90 A The process will work as intended as the MOD function ensures that the
ASCII code of the last characters properly wrap around to correctly map
to the first letters of the alphabet.
B The process will work as intended as the MOD function ensures that the
ASCII code of the first characters properly wrap around to correctly map
to the last letters of the alphabet.
C The process will not work as intended as the MOD function incorrectly
maps the first letters of the alphabet.
D The process will not work as intended as the MOD function incorrectly
maps the last letters of the alphabet.
BACK NEXT
Practice Test 5 | 71
Section I: Multiple Choice
One popular encryption method is to shift the letters by a fixed amount. For in-
stance, if the string “OHIO” is shifted by three letters, 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 programmers 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
BACK NEXT
72 | Practice Test 5
Section I: Multiple Choice
Assume all communication at this organization is in uppercase and offset is a 61 Mark for Review
small positive integer. ASCII to decimal conversion is provided for reference:
The encryption-decryption algorithm above is an example of:
Char Code Char Code
A 65 N 78 A Layered encryption
B 66 O 79
C 67 P 80 B Symmetric encryption
D 68 Q 81
E 69 R 82 C Asymmetric encryption
F 70 S 83
G 71 T 84 D Discrete logarithms
H 72 U 85
I 73 V 86
J 74 W 87
K 75 X 88
L 76 Y 89
M 77 Z 90
BACK NEXT
Practice Test 5 | 73
Section I: Multiple Choice
One popular encryption method is to shift the letters by a fixed amount. For in-
stance, if the string “OHIO” is shifted by three letters, 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 programmers 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
BACK NEXT
74 | Practice Test 5
Section I: Multiple Choice
Assume all communication at this organization is in uppercase and offset is a 62 Mark for Review
small positive integer. ASCII to decimal conversion is provided for reference:
The message “CALL ME” was encrypted using the process above and an offset of 3.
Char Code Char Code Which one of the following is the correct encrypted message?
A 65 N 78
A “ZXII JB” with offset = +3
B 66 O 79
C 67 P 80
D 68 Q 81 B “ZXII JB” with offset = –3
E 69 R 82
F 70 S 83 C “FCOO PH” with offset = +3
G 71 T 84
H 72 U 85 D “FCOO PH” with offset = –3
I 73 V 86
J 74 W 87
K 75 X 88
L 76 Y 89
M 77 Z 90
BACK NEXT
Practice Test 5 | 75
Section I: Multiple Choice
A Make sure that these devices are not covered by insurance because then only those with
insurance will be able to afford them.
B Make assistive technology less costly or free through the government so more people
with disabilities can obtain them.
D Increase the cost of assistive technologies so there is more money available to enhance
these technologies.
76 | Practice Test 5
Section I: Multiple Choice
B The World Wide Web using HTML is able to read in website data sent over the Internet.
✓ C The Internet allows data to be rerouted in case a connection has failed, guaranteeing that
it will find a path to its destination.
Practice Test 5 | 77
Section I: Multiple Choice
✓ A A programmer is tasked with creating a program for a trucking company to have their
drivers find the approximate quickest daily routes through a full day of multiple
deliveries.
✓ B Creating a better lossy compression algorithm for a company that will compress images
better than the current compression algorithm that they are using.
C A programmer is given a list of names that are already sorted, and they must create a
binary search of an already sorted database of names.
D Creating a linear search of a database of accounts that are not in alphabetical order.
78 | Practice Test 5
Section I: Multiple Choice
B num = 10 OR num = 20
C num 10 OR num ≥ 20
Practice Test 5 | 79
Section I: Multiple Choice
✓ A Internet protocols are open and allow people to connect as many devices as they want to
the Internet.
B Internet protocols are established so everyone has the same bandwidth when sending and
receiving information.
C Internet protocols are set so that only users that are using the same devices can connect to
each other.
✓ D Internet protocols make it so data gets where it needs to go through routing and
addressing packets.
80 | Practice Test 5
Section I: Multiple Choice
A board game has a spinner that has 8 different, evenly spaced numbers on it. The 68 Mark for Review
spinner looks like the following.
Which of the following can be used to replace <missing code> so that the code
segment works as intended?
B IF (spin1 = 8)
5 4 RETURN(spin1)
ELSE
RETURN(RANDOM(10, 80))
Practice Test 5 | 81
Section I: Multiple Choice
The price of going to a local water park depends on a person’s age and if they have a 69 Mark for Review
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 Which of the following code segments correctly sets the value of cost?
have the coupon, false otherwise.
Select two answers.
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. A
cost ← 0
cost = 5
ELSE
cost = 10
✓ B
cost ← 0
cost = 5
cost = 10
BACK NEXT
82 | Practice Test 5
Section I: Multiple Choice
C
cost ← 0
cost = 0
ELSE
cost = 10
✓ D cost ← 0
IF age ≥ 6
{
cost = 10
IF coupon
cost = cost / 2
}
BACK NEXT
Practice Test 5 | 83
Section I: Multiple Choice
✓ A C
IF score ≥ 90 IF score ≥ 90
ELSE ELSE
B ✓ D
IF score ≥ 90 IF score ≥ 90
END OF EXAM
Copyright © 2024 by TPR Education IP Holdings, LLC. All rights reserved.
84 | Practice Test 5