AP Computer Science Principles Full-length practice exam 2
70 questions
Header banner
Full-length practice exam 2
0 of 70 answered
~41 min left
Question 1
Which of the following BEST describes the purpose of documentation in a program?
Question 2
Which of the following BEST describes what TCP (Transmission Control Protocol) adds to the basic packet-delivery service of IP?
Question 3
What is displayed when the following pseudocode runs?
result ← 1
REPEAT 5 TIMES
{
result ← result * 2
}
DISPLAY result
Question 4
A photograph is stored in JPEG format (lossy compression) and then decompressed. Which of the following accurately describes the decompressed image?
Question 5
A wireless network uses radio waves to transmit data from a laptop to a router. The router connects to the Internet via a fiber optic cable. At each step in this transmission, what is the fundamental representation of data?
In-content ad
Question 6
Which of the following is an example of DEBUGGING a program?
Question 7
A user receives an email that appears to be from their bank, asking them to click a link and confirm their account password due to "suspicious activity." The link leads to a fake website that looks identical to the real bank's website.
This attack is BEST described as:
Question 8
A social media platform's recommendation algorithm suggests content based on a user's past engagement. Over time, the user primarily sees content that reinforces their existing beliefs.
Which of the following BEST describes a potential harmful effect of this computing innovation?
Question 9
A team uses a shared online document so all members can see the current project plan and leave comments. Which aspect of collaborative development does this MOST directly support?
Question 10
A program that reads a list of numbers and finds the maximum value contains the following bug: when all numbers are negative, it always returns 0. A developer adds a test case with the input [-5, -1, -3] expecting the output -1 but gets 0. After investigation, she realizes the maximum variable was initialized to 0 instead of the first list element.
Which of the following describes the COMPLETE process used to find and fix this bug?
In-content ad
Question 11
A simulation models the spread of a disease through a population. Researchers run the simulation 1,000 times with slightly randomized initial conditions and observe how outcomes vary.
Which of the following BEST explains why running the simulation many times is useful?
Question 12
A pipeline to process data consists of three sequential stages that cannot be parallelized: Stage 1 takes 2 seconds, Stage 2 takes 8 seconds, Stage 3 takes 3 seconds. A programmer proposes splitting Stage 2 into four equal parallel tasks (each 2 seconds) running on four processors simultaneously.
What is the total pipeline time after this optimization?
Question 13
A program runs four tasks. Tasks A and B can run in parallel (no dependencies between them). Task C depends on the output of Task A. Task D depends on the outputs of both B and C.
Task A: 3 seconds
Task B: 5 seconds
Task C: 2 seconds (starts after A)
Task D: 1 second (starts after B and C both finish)
Assuming unlimited parallel processors, what is the minimum time to complete all four tasks?
Question 14
Which of the following is the BEST description of a program specification?
Question 15
Which of the following lists contains the elements in the correct order after a linear (sequential) search of the list [3, 7, 1, 9, 4] for the value 9?
In-content ad
Question 16
A recursive procedure power(base, exp) computes base raised to the power exp using the rule: power(base, exp) = base * power(base, exp - 1), with the base case power(base, 0) = 1.
How many total calls to power (including the initial call) are made when computing power(3, 4)?
Question 17
A government proposes using AI-powered surveillance cameras throughout a city to automatically identify and track individuals by face in real time to reduce crime.
A civil liberties advocate argues this innovation has significant harmful effects. Which of the following BEST articulates the advocate's concern?
Question 18
A student downloads a song from a website that offers "free music." The song was uploaded without the artist's permission and is available for free download. Which of the following BEST describes the legal and ethical issue?
Question 19
A nonprofit creates an online platform connecting volunteers with local food banks, matching volunteer skills and schedules with food bank needs. The platform was built using donated server time and open-source software.
Which of the following BEST explains how this computing innovation addresses both a social problem AND a concern about equitable access to computing resources?
Question 20
A procedure double(n) returns n * 2. What is the value returned by double(double(3))?
In-content ad
Question 21
Which of the following pairs BEST distinguishes a procedure from an event handler?
Question 22
What value does the following pseudocode display?
nums ← [3, 7, 2, 8, 5, 1, 9]
count ← 0
FOR EACH n IN nums
{
IF (n > 4)
{
count ← count + 1
}
}
DISPLAY count
Question 23
A university uses a single server to host its website. As enrollment grows, the website becomes slow for users. The IT department adds two more identical servers and distributes incoming web requests evenly among all three.
This approach BEST demonstrates which computing concept?
Question 24
Consider the following program development scenario:
A student writes pseudocode describing the algorithm.
She tests the pseudocode logic on paper with sample inputs.
She codes the algorithm in a programming language.
She runs the code and discovers it does not handle the case where the input list is empty.
She revises the code to handle empty input and tests again.
At step 4, the student is performing which activity?
Question 25
A citizen science project asks volunteers worldwide to classify galaxy shapes in telescope photographs by viewing images on a website. Thousands of volunteers each classify a few images, producing a large labeled dataset researchers could not create alone.
This is an example of:
In-content ad
Question 26
A developer releases version 1.0 of an app, collects user feedback revealing that the search feature is confusing, and redesigns the search interface for version 2.0. This cycle BEST reflects which principle of program development?
Question 27
ASCII uses 7 bits to encode each character, allowing it to represent 2^7 = 128 characters. Unicode (UTF-32) uses 32 bits per character. Why was Unicode developed?
Question 28
What is displayed when the following pseudocode runs?
x ← 10
IF (x > 5)
{
IF (x > 12)
{
DISPLAY "big"
}
ELSE
{
DISPLAY "medium"
}
}
ELSE
{
DISPLAY "small"
}
Question 29
A student is working on a program that draws shapes on screen. After writing the first version, she notices the circles look slightly off-center. She adjusts a coordinate value, tests again, and the circles look correct. This process BEST illustrates which program development practice?
Question 30
A group of students is designing an app to track school events. They gather requirements by asking students and teachers what features they want before writing any code. This activity is BEST described as which phase of the design thinking process?
In-content ad
Question 31
A run-length encoding (RLE) scheme compresses a row of pixels by replacing consecutive identical values with a count and the value. For example, the row WWWWBBWW is encoded as 4W2B2W.
Using this scheme, what is the compressed encoding of RRRRRRGGGG?
Question 32
A list scores ← [85, 92, 78, 90, 65] is passed to the procedure below. What value does mystery(scores) return?
PROCEDURE mystery(list)
{
best ← list[1]
FOR EACH item IN list
{
IF (item > best)
{
best ← item
}
}
RETURN best
}
Question 33
What is displayed when the following pseudocode runs?
a ← 10
IF a MOD 3 = 0
{
DISPLAY "divisible"
}
ELSE
{
DISPLAY "not divisible"
}
Question 34
On the Internet, data is sent as small units called packets. Which of the following BEST describes why packets are used instead of sending the entire message as one continuous stream?
Question 35
A new app allows patients in rural areas to consult with doctors via video call, eliminating the need to travel long distances to a clinic. Which of the following BEST describes this computing innovation?
In-content ad
Question 36
A company hosts its website on a single server in one data center. The website goes down whenever the data center loses power. Which of the following upgrades would MOST improve the website's fault tolerance?
Question 37
A programmer needs to compute the area of three rectangles with different dimensions and display each area. Which approach BEST demonstrates procedural abstraction?
Question 38
The Internet was designed so that if one path between two computers is unavailable, data can still reach its destination by taking a different path. This property is called:
Question 39
The Internet protocol stack is organized into layers, where each layer provides services to the layer above it and uses services from the layer below it. Which of the following BEST describes why this layered (abstraction) model is useful?
Question 40
A serial (sequential) version of a program takes 60 seconds to run. A parallel version uses 4 processors and contains a portion that cannot be parallelized, which takes 10 seconds. The parallelizable portion takes 50 seconds when run serially. What is the runtime of the parallel version?
In-content ad
Question 41
What is displayed when the following pseudocode runs?
nums ← [10, 20, 30, 40, 50]
total ← 0
FOR EACH n IN nums
{
total ← total + n
}
DISPLAY total
Question 42
Which of the following BEST distinguishes lossy compression from lossless compression?
Question 43
Which of the following Boolean expressions evaluates to true?
Question 44
Which of the following BEST describes the role of a router on the Internet?
Question 45
Two students are collaborating on a program. Student A writes the data-storage module and Student B writes the display module. They agree that the display module will call getData() to retrieve values, regardless of how Student A internally stores the data.
This agreement BEST demonstrates which concept?
In-content ad
Question 46
The following pseudocode is intended to find and return the minimum value in a list nums (which has at least one element).
PROCEDURE findMin(nums)
{
minVal ← nums[1]
FOR EACH n IN nums
{
IF n < minVal
{
minVal ← n
}
}
RETURN minVal
}
What does findMin([8, 3, 6, 1, 5]) return?
Question 47
Two programmers are refactoring a 200-line program to reduce code duplication. Programmer A extracts every block of three or more repeated lines into its own procedure. Programmer B extracts only blocks that compute something conceptually meaningful. Which approach is MORE consistent with good procedural abstraction, and why?
Question 48
A data analyst trains a machine learning model to predict loan approval using historical loan data. She later discovers that the historical data reflects past discriminatory lending practices that denied loans to certain demographic groups at higher rates. The model learns from this pattern and replicates it.
This scenario BEST illustrates which concern about data?
Question 49
A binary search will only work correctly on a list that:
Question 50
Which of the following BEST describes an undecidable problem in computer science?
In-content ad
Question 51
How many different values can be represented using 3 bits?
Question 52
A survey of 10,000 adults asks: "Do you use social media daily?" Results show 68% say yes. A researcher concludes that 68% of all humans use social media daily.
Which flaw in this data analysis is MOST significant?
Question 53
Two tasks must be completed: Task A takes 6 minutes and Task B takes 4 minutes. If run sequentially, total time is 10 minutes. If run in parallel on two processors, what is the minimum possible time to complete BOTH tasks?
Question 54
A company trains a facial recognition system using a dataset of photographs. The dataset contains mostly photographs of people with lighter skin tones. As a result, the system is significantly less accurate for people with darker skin tones.
This is an example of:
Question 55
Which of the following BEST describes the concept of open protocols on the Internet?
In-content ad
Question 56
A health app automatically logs a user's GPS location every 5 minutes throughout the day. Over a year, this produces a detailed record of everywhere the user went.
Which of the following BEST describes a privacy concern raised by this data collection practice?
Question 57
A programmer needs to write a procedure that determines whether a given word is a palindrome (reads the same forwards and backwards). She first writes a procedure that reverses a string, then uses it inside the palindrome-checker. This approach BEST demonstrates which programming concept?
Question 58
A company's website is attacked by a botnet — thousands of compromised computers simultaneously send requests to the website, overwhelming its server and making it unavailable to legitimate users.
This attack is called a:
Question 59
Which of the following BEST describes the digital divide?
Question 60
A digital audio file encodes sound by sampling the audio signal at regular intervals (e.g., 44,100 times per second) and storing each sample as a binary number. Which of the following changes would INCREASE the accuracy of the digital audio representation?
In-content ad
Question 61
Which of the following BEST describes a benefit of collaborating with others during program development?
Question 62
A student is developing an app to help users log daily exercise. During testing, a user reports: "When I enter 0 minutes of exercise, the app crashes." The student had not considered zero as a valid input.
This situation illustrates which challenge in program development?
Question 63
A delivery company needs to find a route that visits 30 cities and returns home with the lowest total distance. An exact algorithm guaranteed to find the optimal route would take an impractically long time. Which approach is MOST appropriate?
Question 64
A researcher studying online misinformation downloads 10 million public tweets using Twitter's API and analyzes which types of false claims spread fastest. The tweets are publicly posted but the users did not know their data would be used for research.
Which of the following BEST represents the ethical tension in this scenario?
Question 65
Which of the following is an example of a Creative Commons license providing more freedom than standard copyright?
In-content ad
Question 66
Which of the following is an example of data abstraction?
Question 67
What is the decimal value of the 8-bit binary number 00001011?
Question 68
Which of the following BEST describes the difference between a problem that has a reasonable algorithm and one that requires an unreasonable algorithm in the CSP framework?
Question 69
A hospital stores patient records in a database. Each record includes the patient's name, date of birth, diagnosis codes, and the date each entry was created. The dates and times when entries were created are examples of which type of data?
Question 70
Which of the following problems has a REASONABLE (polynomial-time) algorithm, and which is considered to have only UNREASONABLE (exponential-time) algorithms for large inputs?
Problem I: Sorting a list of n numbers
Problem II: Checking all possible subsets of n items to find a subset that sums to a target value (brute-force subset sum)
AP Computer Science Principles Full-length practice exam 2 — Free with Answer Explanations | Test Practice Hub