Practice Test 10 - AP Computer Science Principles
19 questions. Answer them in any order, then submit to see your score and every explanation.
- Consider the following code segment: data ← [] APPEND(data, "first") APPEND(data, "second") REMOVE(data, 1) What is the final state of the data list?
- A Monte Carlo program estimates how long a cafeteria line might take during lunch. It uses random values for arrival times and service times to represent day-to-day changes. Randomness is necessary because students arrive in bursts and workers serve at different speeds. One simulation shows a 6-minute wait, while another shows a 14-minute wait with the same settings. Based on the scenario above, what is the role of randomness in this simulation?
- An access control algorithm unlocks a door only if if (userIsAdmin AND withinBusinessHours). Based on the algorithm described, what is the result of the boolean expression when withinBusinessHours is false?
- Which of the following statements best describes a key benefit of a collaborative programming team that includes members with distinct areas of expertise, such as front-end design, back-end logic, and database administration?
- Which of the following is the most effective action for programmers to take to help reduce bias in the computing innovations they develop?
- Which of the following Boolean expressions would be used in a conditional statement to check if a number is between 10 and 20, inclusive?
- Which of the following is a potential harmful societal effect of relying on this platform?
- A music app stores song lengths in seconds and needs the total playlist time. Examine the following code snippet, where a
FORloop iterates through the list and adds each value tototalSecondsso the program can display the overall duration.totalSeconds <- 0 // accumulatorFOR index <- 0 TO LENGTH(times) - 1totalSeconds <- totalSeconds + times[index] // add each song lengthEND FORDISPLAY(totalSeconds)The loop initializesindexat 0, checks the conditionindexup toLENGTH(times) - 1, updatestotalSecondseach iteration, and stops after the last valid index. Iftimesis[120, 180, 240], the purpose is to sum all song lengths. Examine the following code snippet: How many times does the loop execute? - A small online community maintains an open-source "study timer" tool. Jae, a new contributor, fixes a typo and then tackles a larger issue: the timer sometimes resets after pausing. The maintainer, Alina, assigns tasks and reviews submissions; Morgan, another contributor, writes a clear bug report with steps and expected behavior. They coordinate using a version-control platform to propose changes, a forum thread to debate options, and a chat channel for quick clarifications. A conflict arises when Jae suggests a quick patch, but Morgan argues, "It might break long sessions." Alina mediates: "Let's add a test case first, then implement the smallest fix that passes it." Jae and Morgan agree, collaborate on the test, and the final patch is accepted. Users report the pause feature feels dependable. Based on the scenario, how did the team resolve the disagreement about the quick patch?
- In the scenario described, a retail chain stores sales transactions to track monthly performance across product categories. Each receipt becomes one record with fields Month (Jan–Apr), Category (Electronics), and Amount (USD), and the totals are summed by month for reports. Data is collected automatically from the point-of-sale system and used to plan inventory. Based on the dataset provided, what trend can be observed in monthly Electronics sales totals? Totals: Jan $42,000; Feb $39,000; Mar $45,000; Apr $51,000.
- What is the primary benefit of using distributed computing for solving extremely large-scale scientific problems, such as global climate modeling?
- A small company uses 5-bit binary numbers to create unique employee IDs. Assuming the IDs start from 00000 and are assigned sequentially, what is the maximum number of employees the company can have before it runs out of unique IDs?
- What new knowledge could be generated by combining these two data sources that is not available from either source alone?
- Given this shopping cart code, what will the discount be if isMember is true, total is 120, and isSeasonalSale is false? // Online Shopping Cart discount rules IF isMember IF total >= 100 IF isSeasonalSale discount = 20 ELSE discount = 15 ELSE discount = 5 ELSE IF total >= 150 IF isSeasonalSale discount = 10 ELSE discount = 0 ELSE discount = 0
- A passage addresses government cybersecurity regulations that require critical infrastructure operators to meet baseline security standards and submit to periodic audits. It defines a privacy law as restricting personal data processing, and contrasts it with security mandates that may increase monitoring of network activity. The ethical dilemma is setting audit and logging requirements that improve defense while limiting unnecessary surveillance of employees. Stakeholders include operators, employees, regulators, customers, and security vendors. A scenario describes implementing extensive employee activity logs to satisfy auditors, prompting concerns about proportionality. How does the passage illustrate an ethical dilemma in compliance-focused security monitoring?
- What is the most critical security reason for a user to regularly update their device's operating system and applications?
- Which of the following best describes plagiarism in the context of computer science?
- Which of the following scenarios is LEAST likely to be considered crowdsourcing?
- ## Global Perspectives: Unequal Access Across Countries ### Defining the Digital Divide The digital divide refers to unequal access to internet connections, devices, and digital skills. It is significant because online access supports education, business, health information, and communication. ### Different Contexts, Different Barriers The divide looks different across the world. - Developed countries: Access gaps often involve affordability, digital skills, or rural infrastructure. - Developing countries: Barriers may include limited electrical infrastructure, fewer networks, and higher relative costs. - Age and education: Older adults and people with less formal schooling may need more support to use digital tools. ### Evidence and Examples The International Telecommunication Union (ITU) reported that by 2023, roughly two-thirds of the world's population used the internet, meaning billions still remained offline. A student in a high-income country may assume constant connectivity for homework, while a student in a lower-income region may depend on a shared device and intermittent mobile data. ### Efforts to Bridge the Divide International and local efforts include: - Expanding mobile broadband coverage - Building community networks - Supporting affordable devices - Training programs for digital skills ### Why This Matters Closing the gap can widen educational and economic opportunities. However, solutions must fit local realities, including infrastructure and costs. Based on the text, why is understanding the digital divide important for policymakers?