0% found this document useful (0 votes)
49 views84 pages

AP Computer Science Practice Test 4 Interactive

This document contains a practice test for the AP® Computer Science Principles Exam, consisting of multiple-choice questions that assess various programming and computer science concepts. It includes instructions for the exam format, question types, and examples of questions related to coding procedures, algorithms, and data analysis. The test is designed to help students prepare for the official digital exam by providing practice scenarios and coding challenges.

Uploaded by

Yesha Kakkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views84 pages

AP Computer Science Practice Test 4 Interactive

This document contains a practice test for the AP® Computer Science Principles Exam, consisting of multiple-choice questions that assess various programming and computer science concepts. It includes instructions for the exam format, question types, and examples of questions related to coding procedures, algorithms, and data analysis. The test is designed to help students prepare for the official digital exam by providing practice scenarios and coding challenges.

Uploaded by

Yesha Kakkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

e

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

AP® Computer Science Principles Exam


SECTION I: Multiple-Choice Questions

DO NOT BEGIN THE EXAM UNTIL YOU ARE TOLD TO DO SO.


DISCLAIMER: The official AP Computer Science Principles Exam will be administered digitally. Instructions for the digital exam may
At a Glance differ from this practice test.

Total Time Instructions


2 hours Section I has 70 multiple-choice questions and lasts 2 hours.
Number of Questions
70 Each question in this part is followed by four suggested answers. Select the best answer to each question.
Percent of Total Score You can go back and forth between questions in this part until time expires. The clock will turn red when 5 minutes remain—the proctor will
70% not give you any time updates or warnings.

BACK NEXT

2 | Practice Test 4
Section I: Multiple Choice

Consider the following procedure. 1 Mark for Review


Procedure Call Explanation Which of the following code segments can be used to draw the rectangles?
drawRectangle(x1, y1, x2, y2) Draws a rectangle with the top left
coordinate (x1,y1), and the bottom A x ← 1
right coordinate (x2,y2) y ← 11
REPEAT 4 TIMES
{
The drawRectangle method will be used to draw the following on a coordi- drawRectangle(1, 11, 3, 7)
x ← x + 3
nate grid. y ← y + 2
}

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

D The amount of time it took for the tickets to sell out

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

5 Mark for Review


What is an appropriate way to prove that a problem is undecidable?

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

6 Mark for Review


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

Practice Test 5 | 9
Section I: Multiple Choice

Consider the following procedure. 7 Mark for Review


PROCEDURE someMath(num1, num2) What would be output after the following calls to the procedure?
{
x ← someMath(10, 6)
IF (num1 > num2) y ← someMath(2, x)
RETURN(num1 - num2) z ← someMath(x, y)
ELSE DISPLAY(z)
RETURN(num2 * num1)
} A 2

B 4

C 24

D 32

10 | Practice Test 5
Section I: Multiple Choice

8 Mark for Review


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

Practice Test 5 | 11
Section I: Multiple Choice

9 Mark for Review


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

12 | Practice Test 5
Section I: Multiple Choice

10 Mark for Review


The 8-digit binary number 0110 0011 would be how many digits if converted to hexadecimal?

A 63

B 8

C 3

D 2

Practice Test 5 | 13
Section I: Multiple Choice

11 Mark for Review


Which of the following is NOT a firewall?

A Packet-filtering firewall

B Proxy firewall

C Distributed denial of service firewall

D Next generation 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

13 Mark for Review


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

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

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

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

17 Mark for Review


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.

20 | Practice Test 5
Section I: Multiple Choice

THIS PAGE LEFT INTENTIONALLY BLANK.

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?

Name (Open Field) A Name


Age (Dropdown menu)
State (Dropdown menu) B Age
Favorite Candy (Open Field)

C State

D Favorite Candy

24 | Practice Test 5
Section I: Multiple Choice

20 Mark for Review


Which one of the following is NOT an email transfer protocol?

A FTP

B IMAP

C POP3

D SMTP

Practice Test 5 | 25
Section I: Multiple Choice

21 Mark for Review


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.

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.

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 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

D The financial and scholarship records from each student

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

26 Mark for Review


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 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”)

B var dayOdd = day MOD 2


IF (dayOdd = 0 AND week = “Saturday” AND week = “Sunday”)
DISPLAY (“Day Off”)
ELSE
DISPLAY (“Workout”)

C var dayOdd = day MOD 2


IF (dayODD = 0 OR week = “Saturday” OR week = “Sunday”)
DISPLAY (“Day Off”)
ELSE
DISPLAY (“Workout”)

D var dayOdd = day MOD 2


IF (dayODD = 1 AND (week ≠ “Saturday” AND week ≠ “Sunday”))
DISPLAY (“Workout”)
ELSE
DISPLAY (“Day Off”)

32 | Practice Test 5
Section I: Multiple Choice

28 Mark for Review


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

Practice Test 5 | 33
Section I: Multiple Choice

29 Mark for Review


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.

34 | Practice Test 5
Section I: Multiple Choice

30 Mark for Review


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.

Practice Test 5 | 35
Section I: Multiple Choice

31 Mark for Review


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.

36 | Practice Test 5
Section I: Multiple Choice

32 Mark for Review


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

Practice Test 5 | 37
Section I: Multiple Choice

33 Mark for Review


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

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

D day1 = 0, day2 = 20, day3 = 40

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.

D Create a procedure called moveForwardTwice(), and use it to


replace lines 11 and 12.

40 | Practice Test 5
Section I: Multiple Choice

36 Mark for Review


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

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
}

C IF (item > largeNum)


{
INSERT(newList,index,item)
}

D IF (item > largeNum)


{
index ← index + 1
INSERT(newList,index,item)
}

42 | Practice Test 5
Section I: Multiple Choice

THIS PAGE LEFT INTENTIONALLY BLANK.

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

Questions 39–40 refer to the information below. 39 Mark for Review

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

C II and III only

D I, II and III

BACK NEXT

46 | Practice Test 5
Section I: Multiple Choice

Questions 39–40 refer to the information below. 40 Mark for Review

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: }

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

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

43 Mark for Review


Which of the following would be an example of a lossless compression?

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.

B A file is compressed so it may be transmitted quicker, with no guarantees of being able to


restore all the information.

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?

Procedure Call Explanation A IF (prime(i))


APPEND(primeList, i)
prime(number) Returns true if the parameter (number)
is a prime number, false otherwise
B IF (prime(i))
i ← 1
REPEAT 20 TIMES {
{ APPEND(primeList, i)
<missing code> i ← i + 1
} }

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

47 Mark for Review


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.

54 | Practice Test 5
Section I: Multiple Choice

48 Mark for Review


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
IF larger > smaller

larger = smaller

B
IF larger < smaller

var temp = larger


larger = smaller
smaller = temp

C
IF larger < smaller

larger = smaller
smaller = larger

D
IF larger < smaller

var temp = larger


smaller = larger
smaller = temp

Practice Test 5 | 55
Section I: Multiple Choice

49 Mark for Review


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)

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 }

D Change the OR in Line 6 to AND

Practice Test 5 | 57
Section I: Multiple Choice

51 Mark for Review


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.

58 | Practice Test 5
Section I: Multiple Choice

52 Mark for Review


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.

Practice Test 5 | 59
Section I: Multiple Choice

53 Mark for Review


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.

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?

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

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

D II and III 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

57 Mark for Review


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

64 | Practice Test 5
Section I: Multiple Choice

THIS PAGE LEFT INTENTIONALLY BLANK.

Practice Test 5 | 65
Section I: Multiple Choice

Questions 58–62 refer to the information below.

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

i > True Output:


inString outString

False

c ← ASCII code of ith Stop


character in inString

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

Questions 58–62 refer to the information below.

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

i > True Output:


inString outString

False

c ← ASCII code of ith Stop


character in inString

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

Questions 58–62 refer to the information below.

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

i > True Output:


inString outString

False

c ← ASCII code of ith Stop


character in inString

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

Questions 58–62 refer to the information below.

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

i > True Output:


inString outString

False

c ← ASCII code of ith Stop


character in inString

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

Questions 58–62 refer to the information below.

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

i > True Output:


inString outString

False

c ← ASCII code of ith Stop


character in inString

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

63 Mark for Review


Which of the following actions can help bridge the digital divide for people with disabilities?

Select two answers.

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.

C Create grants for more research into technologies.

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

64 Mark for Review


What are some examples that would make a system fault-tolerant?

Select two answers.

A A system is able to send packets as quickly as possible over the Internet.

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.

✓ D If there is a user error occurring somewhere within a system, it will be corrected


automatically so there is no loss in production.

Practice Test 5 | 77
Section I: Multiple Choice

65 Mark for Review


Which of the following tasks would require a heuristic approach to solving a problem?

Select two answers.

✓ 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

66 Mark for Review


Which of the following would produce the same result as

num ≥ 10 AND num ≤ 20

Select two answers.

✓ A NOT (num < 10 OR num > 20)

B num = 10 OR num = 20

C num 10 OR num ≥ 20

✓ D num ≥ 10 AND (NOT (num > 20))

Practice Test 5 | 79
Section I: Multiple Choice

67 Mark for Review


What is true about Internet protocols?

Select two answers.

✓ 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?

8 1 Select two answers.


\
7 2 A IF (spin1 = 8)
RETURN(RANDOM(1, 8) * 10)
ELSE
RETURN(spin1)
6 3

B IF (spin1 = 8)
5 4 RETURN(spin1)
ELSE
RETURN(RANDOM(10, 80))

The game is played in the following way:


C IF (spin1 < 8)
• A random number is chosen from 1 to 8 to simulate the spinner. The player gets the RETURN(spin1)
amount of points equal to the random number. ELSE
• If the first spin was an 8, the player gets another spin. Whatever the player gets on {
the second spin counts as 10 times the amount of that spin. The first spin does not spin2 ← RANDOM(1,8)*10
RETURN(spin2 * 10)
count towards their score. }
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 D IF (spin1 < 8)
returned is 3 times 10, which is 30. RETURN(spin1)
ELSE
{
The procedure game() was created to return the correct value from the spin(s). spin2 ← RANDOM(1,8)
PROCEDURE game() RETURN(spin2 * 10)
}
{
spin1 ← RANDOM(1,8)
<missing code>
}

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

IF age ≥ 6 AND coupon

cost = 5

ELSE

cost = 10

✓ B
cost ← 0

IF age ≥ 6 AND coupon

cost = 5

ELSE IF age ≥ 6 AND NOT coupon

cost = 10

BACK NEXT

82 | Practice Test 5
Section I: Multiple Choice

C
cost ← 0

IF age < 6 AND NOT coupon

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

70 Mark for Review


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?

Select two answers.

✓ A C
IF score ≥ 90 IF score ≥ 90

DISPLAY Exceeds DISPLAY Exceeds

ELSE IF score ≥ 70 IF score ≥ 70 AND score < 90

DISPLAY Meets DISPLAY Meets

ELSE ELSE

DISPLAY Does not meet DISPLAY Does not meet

B ✓ D
IF score ≥ 90 IF score ≥ 90

DISPLAY Exceeds DISPLAY Exceeds

IF score ≥ 70 IF score ≥ 70 AND score < 90

DISPLAY Meets DISPLAY Meets

IF score < 70 IF score < 70

DISPLAY Does not meet DISPLAY Does not meet

END OF EXAM
Copyright © 2024 by TPR Education IP Holdings, LLC. All rights reserved.

84 | Practice Test 5

You might also like