wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AP CSP Exam Review

Total questions: 45

Worksheet time: 1hrs 5mins

Name
Class
Date
1.

What does it mean when we say the Internet is redundant?

a)

Parts of it are unnecessary

b)

If a path is down, packets can be routed a different way

c)

It has a delay between the request and the response to the request

d)

If there is an error, a backup system is brought online to be used

2.

What describes the process of keeping common or similar features and functionality while removing details that are different?

a)

An alorithm

b)

Decomposition

c)

Simulation

d)

Abstraction

3.

How are algorithms and programs related?

a)

They have a hierarchical relationship

b)

Programs implement algorithms

c)

Algorithms implement programs

d)

They can both be run on a computer

4.

What is a benefit of collaboration when writing code?

a)

Collaboration allows the work to be divided among independent programmers to create.

b)

Collaboration makes it easier to document another person's code

c)

Collaboration makes it eastier to find errors

d)

Collaboration produces an increase in user requirements that can be met with more team members.

5.
A photographer is manipulating a digital image and overwriting the original image. Which of the following describes a lossy transformation of the digital image?
a)
Creating the gray scale of an image by averaging the amounts of red, green, and blue in each pixel and assigning this new value to the corresponding pixel in the new image. The new value of each pixel represents a shade of gray, ranging from white to black.
b)
Creating a mirrored image by swapping the RGB values from pixels on the left side of an image with RGB values from pixels on the right side of an image.
c)
Swapping the Red and Green values of each pixel so that areas that were red now appear green and vice versa.
d)
Creating the negative of an image by creating a new RGB triplet for each pixel in which each value is calculated by subtracting the original value from 255. The negative of an image is reversed from the original; light areas appear dark, and colors are reversed.
6.
Which of the following statements are true about lossless compression?
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.
a)
I only
b)
II only
c)
I and II
d)
Neither I nor II
7.
A red triangle is pictured below in a grid of squares. It is currently facing upward, and can only move using the MoveTriangle procedure, shown below. The triangle can move onto white and gray squares, but not onto the black squares.
PROCEDURE MoveTriangle (numMoves, numTurns)
{ 
REPEAT
numMoves TIMES   

MOVE_FORWARD() 
}
 
REPEAT numTurns TIMES 
{   
TURN_RIGHT() 
}
}
Which of the following instructions will get the red triangle to the gray square?
a)
 
MoveTriangle (1, 1) MoveTriangle (1, 1) MoveTriangle (3, 1) MoveTriangle (3, 0)
b)
MoveTriangle (4, 1)
MoveTriangle (4, 0)
c)
MoveTriangle (1, 1)
MoveTriangle (1, 3)
MoveTriangle (3, 1)
MoveTriangle (3, 0)
 
d)
MoveTriangle (1, 1)
MoveTriangle (1, 3)
MoveTriangle (3, 3)
MoveTriangle (3, 0)
8.
Efficiency of algorithms is most often analyzed based on which of the following characteristics?
a)
The number of lines of computer code needed to implement the algorithm.
b)
The time and memory space necessary to run the algorithm.
c)
How easy or difficult the algorithm is to understand.
d)
The size of the output obtained after running the algorithm.
9.
Which of the following statements about abstraction is true?
a)
Abstraction requires users to understand the low-level details of a system.
b)
Abstraction reduces information and detail to facilitate focus on relevant concepts.
c)
Abstraction increases the run-time complexity of a program.
d)
Abstraction compresses a program file to reduce file size.
10.
A programmer is writing code to switch the values of two integer variables, namely 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.
a)
Yes, the code correctly switches the values of 'a' and 'b'.
b)
No, but it will work correctly if statements 1. and 3. are switched.
c)
No, but it will work correctly if statements 2. and 3. are switched.
d)
No, but it will work correctly if statements 1. and 2. are switched.
11.
Trace the value of an integer variable n in the following code.
i ← 1
n ← 2
REPEAT until i = 4
{
  n ← n * 2
  i ← i + 1
}
  What is n?
a)
4
b)
8
c)
16
d)
32
12.
A piece of code that you can easily call over and over again. 
a)
Repeat
b)
Functions
c)
Procedures
d)
Fractions
13.

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

a)

Only I

b)

I and II

c)

I and III

d)

II and III

14.

Which of the following activities poses the LEAST potential cybersecurity risk?

a)

Clicking on a link in an email from an unknown sender

b)

Sharing your device’s private key used for encryption

c)

Sharing your device’s public key used for encryption

d)

Using a credit card to make an online purchase on a website that does not use encryption

15.

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?

a)

64

b)

256

c)

16

d)

128

16.

How many times will this loop run?


for i in range (1, 4):

a)

4

b)

1

c)

2

d)

3

17.

Which one of the following statements about functions is TRUE

a)

A function can change names over the course of a program.

b)

Code can be added or removed dynamically from a function while the program is running.

c)

Functions can be called using different names depending on where in the program they are called.

d)

Two functions can be given identical names as long as their code is identical.

e)

Two functions in a single program can have different names but contain identical code.

18.

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?

a)

Which users post messages most frequently?

b)

What time of day is the site most active?

c)

Which posts from a particular user have received the greatest number of comments?

d)

In what country is the site most active?

19.

Which of the following is irreversible?

a)

lossy compression

b)

lossless compression

c)

abstraction

d)

RLI

20.

Consider the following three binary numbers:

01010

010000

1110

Which of the following lists the numbers in order from least to greatest?

a)

010000

1110

01010


b)

01010

1110

010000


c)

01010

010000

1110


d)

1110

01010

010000


21.
What does Protocol mean?
a)
Security
b)
Rules
c)
Orders
d)
Services
22.

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)

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.

b)

A procedure textMatch, which takes two text files as input and returns true if the two text files are identical.

c)

A procedure isFound, which takes a word and a text file as input and returns true if the word appears in the text file

d)

A procedure sameSize, which takes two text files as input and returns true if the two text files contain the same number of words.

23.

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)

a)

RANDOM(1, 100) > 97

b)

RANDOM(1, 100) >= 97

c)

RANDOM(1, 100) <= 3

d)

RANDOM(1, 100) < 3

24.

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?

a)

Making the code run faster

b)

Making the code more readable

c)

Providing more opportunities for code reuse

d)

Reducing the amount of duplicated code

25.

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?

a)

The code for the binary search algorithm must be written in binary to achieve optimum efficiency

b)

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

c)

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

d)

The list of email addresses must be sorted for binary search to work

26.

Consider the attached procedures.

What is displayed as a result of the procedure call

proc2("birthday", "to you")?

a)

birthday happy to you

b)

to you happy birthday

c)

to you birthday happy

d)

birthday happy birthday

27.

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)

a)

RANDOM(1, 10) <= 3

b)

RANDOM(1, 100) = 30

c)

RANDOM(1, 100) <= 30

d)

RANDOM(1, 10) < 3

28.

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)

a)

Once it is developed, the simulation can run at a faster speed than a real-life experiment.

b)

The simulation can try the addition of even more bike lanes without incurring significant extra cost for each lane added.

c)

As long as the software developers are not biased, the simulation will not include any bias for or against cyclists.

d)

Since they are developing the simulation on a computer, it should be able to represent the proposed changes with 100% accuracy.

29.

Which of the following statements about the ability of computers is most accurate?

a)

There are some problems that personal computers can’t solve, but supercomputers can solve those problems when given enough time to spend on them.

b)

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.

c)

Computers can solve every problem, and do so in a reasonable amount of time.

d)

There are some problems a computer can’t solve, no matter how much time they have.

30.

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?

a)

Calculating the cost of a package based on weight and distance to destination.

b)

Identifying the top-performing delivery carrier in a region, based on the carrier’s performance scores.

c)

Calculating an efficient route for a delivery carrier through a city, considering factors like parking space and mail volume

d)

Sorting packages according to the expected delivery date, from most urgent to least urgent

31.

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?

a)

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.

b)

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.

c)

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.

d)

The tool will not be able to correctly identify any cases of unreachable code.

32.

Which of the following are the benefits of procedural abstraction?

(Select two answers)

a)

Procedural abstraction makes it easier for people to read computer programs.

b)

Procedural abstraction prevents programmers from accidentally using the intellectual property of other programmers.

c)

Procedural abstraction eliminates the need for programmers to document their code

d)

Procedural abstraction provides an opportunity to give a name to a block of code that describes the purpose of the code block.

33.

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?

a)

The heights of the most popular office desks

b)

The three-dimensional shape of the chair

c)

The range of colors available for the chair’s fabric

d)

The tendency of the chair to incline backward in response to pressure from the user

34.

Consider the attached procedure. Consider the following statement:


DISPLAY(doSomething(10, 20))


What is displayed as a result of executing the statement above?

a)

10 20 10

b)

10 20

c)

10 10 20

d)

10 10

35.

An Internet attack that causes a server to crash by making repeated requests to the same IP address:

a)

DDoS (Distributed Denial of Service)

b)

Cache Poisoning

c)

DNS (Domain Name System) Hijacking

d)

Phishing

36.

Internet Protocol

a)

Protocol that breaks data down into packets and addresses them with source and destination information

b)

A DNS attack in which numerous pings are made to the same IP, causing it to crash

c)

Protocol used by the World Wide Web. It describes how messages are formatted and interchanged, and how web servers respond to commands.

d)

Protocol that provides reliable, ordered, and error-checked delivery of a stream of packets on the internet

37.
Tranmission Control Protocol:
a)
Breaks messages into packets and addresses them
b)
A DNS attack in which numerous pings are made to the same IP, causing it to crash
c)
Protocol used by the World Wide Web. It describes how messages are formatted and interchanged, and how web servers respond to commands.
d)
Provides reliable, ordered, and error-checked delivery of a stream of packets on the internet
38.
Which bit-sending technology is used for fiber optic cables?
a)
Electric voltage
b)
Alternating frequencies
c)
Beam of light
d)
Magic
39.
According to the domain name system (DNS), which of the following is a subdomain of the domain code.org?
a)
educate.code.org
b)
code.com
c)
code.org/apcsp/lesson10
d)
code.co.uk
40.
The world is currently in a transition to using IPv6, a newer version of the IP protocol that uses 128-bit addresses instead of 32-bit addresses used by IPv4. What is the main problem that IPv6 was created to solve?
a)
IPv6 will allow problems with IPv4's address hierarchy to be resolved
b)
32-bit addresses could not ensure that every internet-connected device can receive a unique IP address
c)
32-bit addresses could not accommodate the increased size and amount of data traveling on the Internet as it has grown in popularity
d)
IPv4 proved unreliable in some cases where network redundancy could not be ensured
41.

How is the bandwidth of a network measured?

a)

Bitrate. Higher bitrate means higher bandwidth.

b)

Voltage. Higher voltage means higher bandwidth.

c)

Frequency of waves. Higher frequency means higher bandwidth.

d)

Light. More light means higher bandwidth.

42.

What is the latency of a system?

a)

The amount of data (in bits) that can be transmitted at any given time

b)

The distance that data needs to travel in a network

c)

The time it takes for a bit to travel from sender to receiver

d)

The strength of the network connection

43.

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

a)

I only

b)

II only

c)

Both I and II

d)

Neither I nor II

44.

What is the best explanation for why digital data is represented in computers in binary?

a)

The binary number system is the only system flexible enough to allow for representing data other than numbers.

b)

It's easier, cheaper, and more reliable to build machines and devices that only have to distinguish between binary states.

c)

It typically takes fewer digits to represent a number in binary when compared to other number systems (for example, the decimal number system)

d)

It's impossible to build a computing machine that uses anything but binary to represent numbers

45.

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?

a)

Add a bit to studentID to double the number of IDs that the database can represent.

b)

Double the number of bits in studentID to double the number of IDs that the database can represent

c)

Keep using an 8-bit number for studentID but reserve the first bit to indicate middle school or high school.

d)

Remove a bit from studentID to make room for incoming students