Practice Test 8 - AP Computer Science Principles
19 questions. Answer them in any order, then submit to see your score and every explanation.
- A student grades list of integers starts as [70, 85, 90, 60, 95]. You remove the lowest grade using grades.remove(60) to drop one quiz score. Based on the scenario above, how many elements are in the list after the given operations?
- An access control algorithm unlocks a door if if (userIsAdmin AND withinBusinessHours). Based on the algorithm described, how would changing AND to OR impact the outcome?
- Case study (Smart Devices): A city installs "smart" streetlights with motion sensors and networked controllers. The lights dim when streets are empty and brighten when pedestrians or cars approach, aiming to reduce energy costs. A central dashboard collects status data (bulb health, power usage) and sends maintenance alerts. Similar systems appear in many municipalities as part of smart-city initiatives, and vendors often claim measurable energy savings from adaptive lighting. Benefits: The city reports lower electricity bills and quicker repairs because crews replace failing lights before outages occur. Residents also report feeling safer on well-lit routes that brighten as they walk. Harms: The networked design introduces new security risks: if attackers access the control system, they could disrupt lighting patterns. Privacy concerns arise because motion data, while not always personally identifying, can still reveal patterns of movement in specific neighborhoods. The city also becomes reliant on the vendor for software updates; when support is delayed, known vulnerabilities remain unpatched longer than desired. Considering the described technology, what are two benefits and two risks associated with smart devices as described in the passage?
- Given this weather-alert pseudo-code, what will the output be if temp=95, humidity=70, wind=10, isThunderstorm=false? // Inputs: temp, humidity, wind, isThunderstorm IF temp >= 90 IF humidity >= 60 PRINT "Heat Advisory" ELSE IF wind >= 25 PRINT "Wind Alert" ELSE PRINT "No Alert" ELSE IF isThunderstorm IF wind >= 30 PRINT "Severe Storm" ELSE PRINT "Storm" ELSE PRINT "No Alert"
- A team is designing a program with a complex user interface. They decide to create several diagrams that show the layout of buttons, menus, and text fields on each screen. What is the main purpose of this activity in the design phase?
- Which of the following describes how this practice could be viewed as both beneficial and harmful?
- Refer to the text on genome sequencing: parallel computing accelerates read mapping by dividing independent read batches among processors. How does parallel computing improve processing speed?
- What will be displayed by the following code when x = 10? IF(x > 5) { DISPLAY("Large") IF(x > 15) { DISPLAY(" and Very Large") } } ELSE { DISPLAY("Small") }
- A shopping cart updates quantities. Using the pseudocode below, what is the value of total after executing the code?
price <- 12 // dollars per notebook quantity <- 1 // starting quantity total <- 0 // running total total <- total + price * quantity // add 1 notebook quantity <- quantity + 2 // add two more notebooks total <- total + price * quantity // add 3 notebooks - Case study (Cloud Computing): A community college migrates its learning management system (LMS) and student email to a cloud vendor. The LMS hosts assignments, discussion boards, and grades; cloud hosting means the vendor manages servers, updates, and storage while the college pays a subscription. During midterms, the system automatically scales to handle heavy traffic. Many institutions adopt similar services; EDUCAUSE surveys routinely report widespread reliance on cloud-based academic tools. Benefits: Students access course materials from any device, and instructors post feedback quickly. The IT department spends less time replacing hardware and more time supporting teachers. Automatic updates patch known vulnerabilities faster than the college's previous manual process. Harms: The college becomes dependent on the vendor's uptime; when a regional outage hits the vendor, students cannot submit assignments for hours. A misconfigured permission setting briefly exposes a folder containing advising notes, raising privacy concerns under student data protections. The subscription cost also increases after the first contract period, and switching vendors would require migrating years of courses. Which statement best summarizes the dual impact of cloud computing in the passage?
- In the scenario described, a social media team logs weekly post performance to plan future content. Data is collected from the platform's insights page and stored as one row per week with columns Week, PostsPublished, and TotalShares. The purpose is to predict future sharing if posting stays consistent. Based on the data, what prediction can be made about total shares next week if 4 posts are published? Data: 1 post→40 shares; 2→85; 3→120; 4→165.
- Which of the following is a primary difference between parallel and distributed computing?
- A city collects numerical speed and car-count data from cameras at intersections and stores it in time-stamped logs. A program detects congestion by comparing current speeds to typical speeds for that time of day. It then adjusts traffic light durations to improve flow during rush hour. Based on the scenario above, what is a potential limitation of the data processing method described?
- ## Economic Barriers: Smartphones vs. Full Access ### Defining the issue The digital divide is the gap in access to reliable internet, appropriate devices, and digital skills. It matters because many "basic" tasks—resumes, benefits forms, and school portals—are easier on a computer with stable broadband. ### Relevant findings Pew Research Center has found that lower-income adults are more likely to be "smartphone-only" users. The passage explains that smartphone-only access can make it difficult to upload files, compare information across tabs, or type long responses. ### Who is affected - Income: Families may choose a phone plan over home broadband to manage costs. - Location: Limited provider choice can keep prices high. - Age: Some adults may need training to avoid scams and protect passwords. ### Bridging efforts The passage highlights combined solutions: - low-cost broadband options - refurbished laptops - community Wi-Fi - digital literacy instruction ### Central point Access is not just "any internet," but internet and devices that support real tasks. Based on the text, what is a significant barrier to closing the digital divide as mentioned in the passage?
- Students collaborate on a game design project about exploring an underwater city. Talia programs movement and collision, Bruno creates art assets and animations, and Keisha writes dialogue and mission objectives. They communicate through a shared folder for assets, a weekly planning call, and short messages when something blocks progress. During integration, Talia says the new animation file breaks the game's loading screen. "The file name doesn't match what the game expects," Talia explains. Bruno responds, "I renamed it to stay organized, but I didn't realize it was referenced elsewhere." Keisha suggests, "Let's document naming rules so this doesn't repeat." They agree to restore the expected name, add a simple naming guide in their shared notes, and confirm the fix together. The game runs smoothly at the next playtest, and the team earns praise for cohesion. In the described project, how did the team resolve the conflict over the renamed animation file?
- Case study (Artificial Intelligence in Healthcare): A regional hospital network deploys an AI system to assist radiologists in detecting early signs of lung cancer on CT scans. The innovation uses machine learning, meaning the software learns patterns from thousands of labeled images and then estimates the probability that a new scan contains suspicious nodules. The hospital integrates the tool into its workflow: the AI highlights areas of concern, and a clinician makes the final diagnosis. A 2023 U.S. FDA announcement notes a growing number of AI-enabled medical devices cleared for clinical use, reflecting real-world adoption. The network also pilots a personalized-medicine feature that combines lab results, medication history, and wearable data (like heart rate trends) to recommend follow-up tests. Benefits: The hospital reports shorter wait times for scan reviews and more consistent "second-look" screening in busy weeks. In one month, the AI flags subtle nodules that a fatigued overnight team might miss, enabling earlier follow-up for several patients. Administrators note efficiency gains: fewer repeat scans, faster triage, and improved access for rural clinics that can upload images for review. Harms: The same system introduces risks. Because it requires large datasets, the hospital stores sensitive imaging and health records in a centralized repository; a ransomware attempt forces the network to temporarily disconnect systems, delaying non-urgent appointments. Ethical concerns also emerge: the training data underrepresents certain demographic groups, and clinicians worry the model may be less accurate for them (algorithmic bias, meaning uneven performance across groups). Finally, some staff fear "automation complacency," where clinicians may over-trust the AI's highlights and overlook unmarked abnormalities. Based on the case study, what are two benefits and two risks associated with AI in healthcare as described in the passage?
- A school app must sort student test scores (integers) in ascending order; input is scoreList and output is sortedScoreList, and the list may be very large. Based on the described problem, What is a potential limitation of the algorithm?
- Based on the scenario described, an Online Retail System wants faster product recommendations without reading every item a customer ever viewed. Raw data includes individual clicks, cart adds, purchases, returns, star ratings, and written reviews. The system abstracts this into (1) CustomerProfile (shipping region, preferred sizes, budget range), (2) PurchasePatterns (most common categories, average spend, repeat brands), and (3) FeedbackSummary (average rating by category, return rate). These summaries are updated nightly so the recommendation algorithm can run quickly during the day. When a customer opens the app, the algorithm compares their PurchasePatterns to similar customers and recommends items from categories with high FeedbackSummary scores.
Pseudocode:
FUNCTION recommend(customerID): c <- Customers[customerID] neighbors <- FIND_SIMILAR(c.PurchasePatterns) candidates <- TOP_ITEMS(neighbors, by = "category") RETURN FILTER(candidates, minRating = c.FeedbackSummary.threshold)Considering the example provided, which abstraction technique is used in the scenario to simplify data handling? - A passage in Arial describes AI and Surveillance in a city transit system. It explains an AI system that uses facial recognition and gait analysis to flag "anomalous" behavior, then alerts human security staff. It defines a privacy law as rules governing collection and processing of personally identifiable information, and notes some jurisdictions require notice, limits on retention, and proportional use for public safety. Stakeholders include commuters, transit authorities, AI vendors, civil liberties groups, and courts. The passage gives scenarios: (1) a false match leading to a brief detention; (2) data retained for years "just in case"; and (3) an audit request for bias testing results. How does the passage illustrate an ethical dilemma in AI surveillance?