Practice Test 11 - AP Computer Science Principles
20 questions. Answer them in any order, then submit to see your score and every explanation.
- According to the scenario, a school board uses an epidemiological simulation to evaluate a policy of staggered lunches. The real-world problem is reducing outbreaks while keeping classes in person. The simulation runs in daily steps and tracks Susceptible, Infected, and Recovered students. infectionRate (0.05–0.25) applies per close contact, and contactRate (5–25 contacts per day) changes with lunch scheduling. recoveryRate (0.10–0.35) controls how quickly students leave the infected state. populationDensity (low/medium/high) scales how many close contacts occur in shared spaces. The algorithm performs repeated runs: set initial parameters, simulate 45 days, compare peakInfected to a threshold the nurse can manage, then adjust contactRate assumptions for different lunch schedules and rerun until results stabilize. Example: reducing contactRate from 20 to 12 through staggered lunches often lowers peakInfected even if infectionRate stays the same. What impact does changing contactRate have in the simulation?
- Consider the following code segment. The procedure
CONCAT(s1, s2)concatenates stringss1ands2. strA ← "rock" strB ← "paper" strC ← "scissors" result ← CONCAT(strA, CONCAT(strC, strB)) What is the final value of theresultvariable? - A wearable collects numerical step counts and heart rate readings and stores them in a weekly summary. A program compares the user's activity to personal goals, calculates progress percentages, and sends reminders when progress falls behind. The reminders help users adjust habits over time. Based on the scenario above, what is a potential limitation of the data processing method described?
- Consider the code segment below.
`str ← "start"
REPEAT 3 TIMES
{
str ← str + "-middle"
}
str ← str + "-end"`
What is the final value of the string variable
strafter the code executes? - Case study (Cloud Computing): A mid-sized architecture firm moves from on-site servers to a cloud provider to store design files and run rendering software. Cloud computing means the firm rents computing power and storage over the internet, scaling up during deadlines and scaling down afterward. Employees collaborate in real time on shared models, and the firm uses automated backups across multiple data centers. According to a 2023 Flexera report, a large majority of organizations use public cloud services, reflecting how common this shift becomes. The firm also adopts cloud-based email and video meetings, enabling remote work for employees who live far from the main office. Benefits: Managers cite cost reduction because they avoid purchasing new servers every few years. Project teams share large files quickly with clients, and version history reduces mistakes from emailing outdated attachments. During a heat wave that causes a local power outage, staff continue working from home because the cloud services remain available. Harms: The dependency on the provider creates vulnerabilities. A misconfigured access setting exposes a folder of client blueprints, raising confidentiality concerns. When the provider experiences an outage, the firm cannot access key files for several hours, delaying a deadline. The firm also faces "vendor lock-in": switching providers would require time-consuming data migration and retraining. Considering the described technology, how does cloud computing positively and negatively impact society according to the passage?
- A shopping cart adds two items. Using the pseudocode below, what is the value of total after executing the code?
price <- 8 // dollars per item quantity <- 3 // number of items total <- 0 // running cart total total <- total + price * quantity // add first item total <- total + 5 * 2 // add second item total <- total - 4 // apply discount - Read the passage. A university payroll office protects staff data by applying safe computing principles: updates, access controls, and secure storage. Privacy concerns include preventing casual browsing of salary information and home addresses. Security concerns include stopping attackers from changing direct-deposit details. The office uses network segmentation, meaning sensitive systems are separated to limit spread. It also uses a firewall, which filters network traffic based on rules. Employees receive training on malware, which is harmful software that can steal data or lock files. A breach occurs when an employee opens a disguised attachment, and malware installs quietly. The malware captures keystrokes, including passwords, and attackers access payroll accounts. The university pays recovery costs, issues notifications, and experiences reputational damage (Cybersecurity and Infrastructure Security Agency [CISA], 2023). How does the passage illustrate the impact of malware on data security?
- When the procedure
displayItemis called, what value is assigned to thecostparameter? - An online store shows free shipping when if (isMember OR purchaseOver100) is true; otherwise it adds a shipping fee. Based on the algorithm described, what is the result of the boolean expression when isMember is false and purchaseOver100 is true?
- A club leader sorts nameList for printing. The list is usually small (around 20 names), but can reach 5,000. Two algorithms are available:
Pseudocode (Bubble Sort):
procedure bubbleSort(nameList) n <- length(nameList) for i <- 1 to n - 1 for j <- 1 to n - i if nameList[j] > nameList[j + 1] swap(nameList[j], nameList[j + 1])Time complexity: . Pseudocode (Merge Sort):procedure mergeSort(nameList) if length(nameList) <= 1 return nameList mid <- length(nameList) / 2 left <- mergeSort(nameList[1..mid]) right <- mergeSort(nameList[mid+1..end]) return merge(left, right)Time complexity: . Considering the time complexities mentioned, under what conditions does mergeSort outperform bubbleSort? - An algorithm successfully solves a particular instance of a problem. What can be concluded about the decidability of the problem based on this single result?
- A simple interest calculator uses this pseudocode. What is the value of amount after executing the code?
principal <- 200 // starting money rate <- 0.05 // yearly interest rate time <- 3 // years interest <- principal * rate // one-year interest interest <- interest * time // total interest amount <- principal + interest // final amount - A school district commissions educational software for remote learning, including a program called LessonPath. The program presents short interactive lessons, checks answers, and offers hints when students struggle. It also tracks which concepts each student has mastered and which ones need reinforcement, then suggests the next activity accordingly. Teachers use summary reports to plan small-group sessions, while students see progress badges that encourage persistence. Families want clarity, and administrators want evidence the tool supports learning goals. According to the text, what purpose does the program serve in its context of use?
- A student claims that any undecidable problem could eventually be solved if computers become infinitely fast. Which of the following statements best refutes this claim?
- A team of students builds a mental-health check-in app with privacy in mind. Zuri drafts empathetic prompts and ensures language is respectful; Cal codes the check-in flow; Wen designs the interface and chooses calming colors; Hugo tests usability and documents confusing steps. They communicate through a shared chat for daily updates, a shared document for wording, and short meetings to make decisions together. A conflict arises when Wen wants more screens for elegance, but Hugo says, "Extra steps may discourage users." Zuri proposes, "Let's test two versions with classmates and compare reactions." Cal adds, "I can implement both quickly if we keep changes small." After a quick comparison, they choose the simpler flow and revise prompts based on peer feedback. The pilot group reports the app feels approachable and easy to complete. Based on the scenario, which communication method was most effective for refining the app's wording collaboratively?
- A database stores sorted usernames array ["adam", "bella", "carlos", "dina", "eli", "fatima", "gwen", "hugo", "ivan"] and searches for target "fatima" using iterative binary search; midpoint is , comparing strings alphabetically. Steps: low=0, high=8, mid=4 ("eli") < "fatima" so low=5; next mid==6 ("gwen") > "fatima" so high=5; next mid==5 ("fatima") found. Refer to the array provided above. How many iterations are required to locate the target element using binary search?
- Read the passage. A media company publishes articles, photos, and videos and uses different compression methods depending on content. Compression reduces the number of bits needed by encoding patterns more efficiently, helping files download faster and cost less to store. Lossless compression preserves exact data and is favored for text, where accuracy matters, while lossy compression discards some information to achieve smaller files and is common for images and video. Huffman coding and LZW are lossless techniques often used for text or general data, while JPEG is a popular lossy format for still images. MPEG is widely used for video compression, often balancing quality against file size. Selecting the right method depends on whether perfect fidelity or smaller size is the priority. Based on the text, how does Huffman coding differ from JPEG compression?
- In the context of the program described, in what order are procedures called to compute each student's final grade?
- A school weather station collects numerical temperature and humidity readings each hour for a month and stores them in a spreadsheet-like table. A program cleans missing entries, calculates daily highs and lows, and looks for repeating patterns across weeks. It uses those patterns to estimate likely conditions for the next few days. Based on the scenario above, what is the main purpose of the program in the described scenario?
- A remote-learning platform introduces a program named ProgressPath to support students who struggle with self-paced study. ProgressPath breaks lessons into small steps, asks quick questions, and immediately offers hints when a student misses a concept. It records broad indicators like completion rate, confidence ratings, and which hint types helped most. The next session, it selects activities that match the student's needs, aiming to build momentum rather than punish mistakes. Teachers receive weekly summaries, while students see encouraging milestones. Administrators want the system to scale across many classes without losing clarity. According to the text, How does the program improve user experience according to the passage?