Font size
WorksheetsAP CSP Exam Review
Total questions: 45
Worksheet time: 1hrs 5mins
What does it mean when we say the Internet is redundant?
Parts of it are unnecessary
If a path is down, packets can be routed a different way
It has a delay between the request and the response to the request
If there is an error, a backup system is brought online to be used
What describes the process of keeping common or similar features and functionality while removing details that are different?
An alorithm
Decomposition
Simulation
Abstraction
How are algorithms and programs related?
They have a hierarchical relationship
Programs implement algorithms
Algorithms implement programs
They can both be run on a computer
What is a benefit of collaboration when writing code?
Collaboration allows the work to be divided among independent programmers to create.
Collaboration makes it easier to document another person's code
Collaboration makes it eastier to find errors
Collaboration produces an increase in user requirements that can be met with more team members.
I - Lossless compression is used only to send files over the Internet
II - Sending a compressed version of a file ensures that the contents of the file cannot be intercepted by an unauthorized user.
PROCEDURE MoveTriangle (numMoves, numTurns)Which of the following instructions will get the red triangle to the gray square?
{
REPEAT numMoves TIMES
{
MOVE_FORWARD()
}
REPEAT numTurns TIMES
{
TURN_RIGHT()
}
}
MoveTriangle (1, 1) MoveTriangle (1, 1) MoveTriangle (3, 1) MoveTriangle (3, 0)
MoveTriangle (4, 1)
MoveTriangle (4, 0)
MoveTriangle (1, 1)
MoveTriangle (1, 3)
MoveTriangle (3, 1)
MoveTriangle (3, 0)
MoveTriangle (1, 1)
MoveTriangle (1, 3)
MoveTriangle (3, 3)
MoveTriangle (3, 0)
a and b, using a temporary integer variable, temp. Will the pseudo-code correctly perform the required task (assume that a and b are never numerically equal)?This is the pseudo-code that the programmer has come up with:
temp ← a # statement 1.
b ← temp # statement 2.
a ← b # statement 3.
Trace the value of an integer variableWhat is n?nin the following code.
i ← 1
n ← 2
REPEAT until i = 4
{
n ← n * 2
i ← i + 1
}
Why is it important to focus on programming style in addition to programming functionality?
I) Program style helps others understand your program and maintain it
II) Programming style only applies to certain programming languages
III) Programming style increases the reusability of your code
Only I
I and II
I and III
II and III
Which of the following activities poses the LEAST potential cybersecurity risk?
Clicking on a link in an email from an unknown sender
Sharing your device’s private key used for encryption
Sharing your device’s public key used for encryption
Using a credit card to make an online purchase on a website that does not use encryption
Suppose we used an Internet Addressing protocol that used 8 bits to encode a single address. With this protocol, how many devices would be able to have their own unique address?
64
256
16
128
How many times will this loop run?
for i in range (1, 4):
4
1
2
3
Which one of the following statements about functions is TRUE
A function can change names over the course of a program.
Code can be added or removed dynamically from a function while the program is running.
Functions can be called using different names depending on where in the program they are called.
Two functions can be given identical names as long as their code is identical.
Two functions in a single program can have different names but contain identical code.
A blogging Website allows users to post messages and to comment on other messages that have been posted. When a user posts a message, the message itself is considered data. In addition to the data, the site stores the following metadata.
The time the message was posted;
The name of the user who posted the message;
The names of any users who comment on the message and the times the comments were made;
Which of the following questions could NOT be answered using only the data and metadata collected?
Which users post messages most frequently?
What time of day is the site most active?
Which posts from a particular user have received the greatest number of comments?
In what country is the site most active?
Which of the following is irreversible?
lossy compression
lossless compression
abstraction
RLI
Consider the following three binary numbers:
01010
010000
1110
Which of the following lists the numbers in order from least to greatest?
010000
1110
01010
01010
1110
010000
01010
010000
1110
1110
01010
010000
Which of the following procedures would be most useful as part of a program to determine whether a word appears in two different text files?
A procedure getWords, which takes a positive integer n and a text file as input and returns the first n words in the text file.
A procedure textMatch, which takes two text files as input and returns true if the two text files are identical.
A procedure isFound, which takes a word and a text file as input and returns true if the word appears in the text file
A procedure sameSize, which takes two text files as input and returns true if the two text files contain the same number of words.
A web developer is creating an online lottery scratch card. The attached incomplete code segment decides whether the player wins a prize. The code should only give the player a 3% chance of winning a prize.
Which of these can replace <MISSING CONDITION> so that the code works as intended?
(Select two answers)
RANDOM(1, 100) > 97
RANDOM(1, 100) >= 97
RANDOM(1, 100) <= 3
RANDOM(1, 100) < 3
A computer science student completes a program and asks a classmate for feedback. The classmate suggests rewriting some of the code to include more procedural abstraction.
Which of the following is NOT a benefit of procedural abstraction?
Making the code run faster
Making the code more readable
Providing more opportunities for code reuse
Reducing the amount of duplicated code
A high school provides email addresses to freshman students. The email system typically assigns an email address in the format "firstname.lastname@coolschool.edu". However, if a student has the same name as a previous student, the system assigns them a different format.
In order to figure out whether an email address is already assigned, the system does a binary search through its list of existing email addresses.
Which of these statements is true?
The code for the binary search algorithm must be written in binary to achieve optimum efficiency
The list of email addresses don’t need to be sorted for binary search to work, but that would improve the efficiency of the algorithm
In the worst-case scenario that the email address is not in the list, binary search will need to look at every item in the list
The list of email addresses must be sorted for binary search to work
Consider the attached procedures.
What is displayed as a result of the procedure call
proc2("birthday", "to you")?
birthday happy to you
to you happy birthday
to you birthday happy
birthday happy birthday
A game developer is working on a soccer video game. The attached incomplete code segment is run when a player attempts a goal from outside the 6-yard box. At that distance, the code should give the player a 30% chance of making the goal.
Which of these can replace <MISSING CONDITION> so that the code works as intended?
(Select two answers)
RANDOM(1, 10) <= 3
RANDOM(1, 100) = 30
RANDOM(1, 100) <= 30
RANDOM(1, 10) < 3
A city government would like to make their streets more bike-friendly with features such as protected bike lanes. However, government officials are concerned about the effect on traffic flow. They hire a software consultant agency to develop a simulation of the traffic after the proposed changes.
What are the most likely benefits of creating a computer simulation of the proposal?
(Select two answers)
Once it is developed, the simulation can run at a faster speed than a real-life experiment.
The simulation can try the addition of even more bike lanes without incurring significant extra cost for each lane added.
As long as the software developers are not biased, the simulation will not include any bias for or against cyclists.
Since they are developing the simulation on a computer, it should be able to represent the proposed changes with 100% accuracy.
Which of the following statements about the ability of computers is most accurate?
There are some problems that personal computers can’t solve, but supercomputers can solve those problems when given enough time to spend on them.
There are some problems that current computers can’t solve, but we hypothesize that more powerful computers in the near future will be able to solve them.
Computers can solve every problem, and do so in a reasonable amount of time.
There are some problems a computer can’t solve, no matter how much time they have.
The United States Postal Service (USPS) delivers nearly 200 million pieces of mail every day. Their website and internal operations are powered by many algorithms.
Which algorithm's runtime is most likely to be improved by the use of a heuristic?
Calculating the cost of a package based on weight and distance to destination.
Identifying the top-performing delivery carrier in a region, based on the carrier’s performance scores.
Calculating an efficient route for a delivery carrier through a city, considering factors like parking space and mail volume
Sorting packages according to the expected delivery date, from most urgent to least urgent
A company is developing a tool to detect "unreachable code": code in a program that will never be executed because no paths ever lead to that line of code. They want to release the tool with the promise that it will "find and delete 100% of the unreachable code in your codebase!"
Unfortunately, one of the programmers does some research and realizes that determining whether a line of code is unreachable is an undecidable problem.
What are the consequences of the problem being undecidable?
The programmers may be able to come up with an algorithm to find 100% of the unreachable code, but nobody has come up with the algorithm yet, so they will need more development time.
The programmers can come up with an algorithm that correctly determines unreachable code most of the time, but it will not correctly identify unreachable code in all cases.
The programmers can come up with an algorithm that will find 100% of the unreachable code, but it would take an unreasonable amount of time to run.
The tool will not be able to correctly identify any cases of unreachable code.
Which of the following are the benefits of procedural abstraction?
(Select two answers)
Procedural abstraction makes it easier for people to read computer programs.
Procedural abstraction prevents programmers from accidentally using the intellectual property of other programmers.
Procedural abstraction eliminates the need for programmers to document their code
Procedural abstraction provides an opportunity to give a name to a block of code that describes the purpose of the code block.
Dominic is an industrial designer who's developing an office chair that is more comfortable for tall individuals. He hires a software engineering firm to develop a simulation that can simulate the chair used by a person working at a desk, and then come up with an estimate of the resulting comfort level.
Which detail is least necessary for this simulation?
The heights of the most popular office desks
The three-dimensional shape of the chair
The range of colors available for the chair’s fabric
The tendency of the chair to incline backward in response to pressure from the user
Consider the attached procedure. Consider the following statement:
DISPLAY(doSomething(10, 20))
What is displayed as a result of executing the statement above?
10 20 10
10 20
10 10 20
10 10
An Internet attack that causes a server to crash by making repeated requests to the same IP address:
DDoS (Distributed Denial of Service)
Cache Poisoning
DNS (Domain Name System) Hijacking
Phishing
Internet Protocol
Protocol that breaks data down into packets and addresses them with source and destination information
A DNS attack in which numerous pings are made to the same IP, causing it to crash
Protocol used by the World Wide Web. It describes how messages are formatted and interchanged, and how web servers respond to commands.
Protocol that provides reliable, ordered, and error-checked delivery of a stream of packets on the internet
How is the bandwidth of a network measured?
Bitrate. Higher bitrate means higher bandwidth.
Voltage. Higher voltage means higher bandwidth.
Frequency of waves. Higher frequency means higher bandwidth.
Light. More light means higher bandwidth.
What is the latency of a system?
The amount of data (in bits) that can be transmitted at any given time
The distance that data needs to travel in a network
The time it takes for a bit to travel from sender to receiver
The strength of the network connection
Which of the following are true about Internet routing?
I - For any two points on the Internet, there exists only one path between the two points
II - Routing on the Internet is fault tolerant and redundant
I only
II only
Both I and II
Neither I nor II
What is the best explanation for why digital data is represented in computers in binary?
The binary number system is the only system flexible enough to allow for representing data other than numbers.
It's easier, cheaper, and more reliable to build machines and devices that only have to distinguish between binary states.
It typically takes fewer digits to represent a number in binary when compared to other number systems (for example, the decimal number system)
It's impossible to build a computing machine that uses anything but binary to represent numbers
A middle school is expanding to open a high school next year, doubling the total number of students. The school keeps a database in which each student's unique ID number is stored as an 8 bit number called studentID. Before the arrival of the new students almost every 8 bit number has already been assigned to a student. Of the options provided below, which is the smallest change to the way studentID is represented necessary to ensure each incoming student receives a unique ID?
Add a bit to studentID to double the number of IDs that the database can represent.
Double the number of bits in studentID to double the number of IDs that the database can represent
Keep using an 8-bit number for studentID but reserve the first bit to indicate middle school or high school.
Remove a bit from studentID to make room for incoming students
