Skip to main content

AP Computer Science Principles Unit 2: Data

Ready When You Are

Select a course and unit, then start practicing.

Data connects to later units in AP Computer Science Principles. Solid practice now reduces rework when those ideas reappear in combined scenarios.

Data covers core AP Computer Science Principles concepts tested on the AP exam. On the AP Computer Science Principles exam, items from Data often ask you to apply course concepts to a scenario you have not memorized verbatim rather than recall isolated terms.

Review your class notes for Data and list the ideas your teacher repeated most—those recurring themes are usually what AP stems disguise in new contexts.

Data is a core thread in AP Computer Science Principles. Even without a single posted weight, you will see these ideas recur on MCQs and free-response tasks that blend multiple units.

Students sometimes overfit Data to one classroom example. AP writers deliberately vary context; practice explaining the underlying rule so it travels to new settings.

When you miss a question, tag it by skill (vocabulary, calculation, inference). Patterns in your misses show where to reread your notes.

Keep a running list of miss types for Data—vocabulary, setup, or inference. Three sessions with the same miss pattern mean reread that thread in your notes before practicing more questions.

Click Practice above for fresh MCQs tied to Data. Answer, read the explanation, and log one sentence about why the correct choice works—that habit compounds faster than grinding endless worksheets.

Sample questions

A few exam-style multiple-choice questions from this unit, with answers and explanations.

  1. Question 1

    A team randomly selects nine page-load times, in seconds, for each of two website configurations. Configuration A produces 2,2,3,3,3,4,4,4,202, 2, 3, 3, 3, 4, 4, 4, 20 seconds, while configuration B produces 4,4,4,4,4,4,4,4,44, 4, 4, 4, 4, 4, 4, 4, 4 seconds. The team wants to choose the configuration with the faster typical page load and will investigate unusually slow loads separately. Which conclusion is best supported by these data?

    • A

      Choose configuration A: its median is 33 seconds, compared with 44 seconds for B; investigate the unusually slow A load separately.

      Correct answer
    • B

      Treat the configurations as equivalent because configuration A’s one unusually slow load offsets its faster observations.

    • C

      Choose configuration B: its mean is 44 seconds, compared with 55 seconds for A, so B has the faster typical load.

    • D

      Choose configuration A after removing the 2020-second observation, since unusually large observations should not affect comparisons.

    Explanation

    The median is a useful measure of a typical value when a dataset contains an extreme observation. Configuration A’s median is 33 seconds, while configuration C’s is 44 seconds, so the sample supports choosing A for a faster typical load. The 2020-second result should be retained and investigated rather than silently discarded. Because the samples are limited, the team should avoid claiming that every load on A will be faster. A is correct: it compares the medians and treats the unusual observation as data worth investigating. C is incorrect: the mean for A is increased by its one unusually slow load, so it does not represent the typical load as well in this scenario. D is incorrect: there is no evidence that the 2020-second measurement is an error, and removing it without justification would distort the data. B is incorrect: the median comparison shows that the typical observed load differs, even though A also has an unusually slow observation.

  2. Question 2

    A school data team creates a bar chart showing the number of students who checked out laptops each month: January, 198198; February, 201201; March, 204204; and April, 207207. The chart’s vertical axis begins at 195195, and the team says laptop checkouts rose sharply. Which change would make the chart support a more accurate conclusion?

    • A

      Convert each month’s count to its share of the four-month total and use a pie chart to show the trend.

    • B

      Rescale the monthly counts so January is 00 and April is 100100, then compare the resulting bars.

    • C

      Start the vertical axis at zero and note that checkouts increased by 99 from January to April.

      Correct answer
    • D

      Keep the current axis but add the exact count above each bar so the visual comparison is reliable.

    Explanation

    C bar chart’s bar lengths are compared from the axis baseline. Starting the axis at 195195 makes the bars look much more different than the counts are; starting at zero shows the modest increase of 99 checkouts, about 4.5%4.5\% of January’s count.

    C: Correct. C zero baseline represents the counts proportionally and supports a suitably cautious conclusion. D: Exact labels provide useful information, but they do not remove the visual exaggeration caused by the truncated axis. A: C pie chart shows each month’s share of the total, not the month-to-month trend, and is not the best representation for this comparison. B: Rescaling the minimum and maximum to 00 and 100100 exaggerates the differences rather than preserving the original counts’ relative sizes.

  3. Question 3

    A greenhouse system is scheduled to record humidity once per day. One week, its readings are 4242, 4444, missing because the sensor was disconnected, 4646, and 4343. A dashboard is designed to report the mean of the available readings and show whether any readings are missing. Which data-handling approach best supports an accurate report?

    • A

      Replace the missing reading with 00 and calculate the mean using all five values.

    • B

      Discard all five readings because one day's value is unavailable, and report no mean for the week.

    • C

      Copy the second day's reading into the third day, then calculate a mean using all five values.

    • D

      Keep the third reading marked as missing, calculate a mean of 43.7543.75 from the four recorded values, and flag the incomplete data.

      Correct answer

    Explanation

    The missing entry means no humidity measurement was collected; it does not indicate a humidity of 00. The mean of the four observed readings is (42+44+46+43)/4=43.75(42+44+46+43)/4=43.75. Keeping the missing value distinct and noting the incomplete record makes the transformation transparent and prevents the dashboard from implying complete data.

    A is incorrect because treating missing data as an actual 00 would lower the mean and misrepresent what was measured.

    C is incorrect because copying a previous reading invents a measurement and can distort the result.

    B is incorrect because the four valid readings can still be summarized; the report should disclose the missing entry rather than discard all collected data.

  4. Question 4

    A library system compares daily checkout totals across branches when planning staff schedules. Each successful checkout receives a unique transaction ID, but a network retry can cause the same transaction to appear more than once in the log. The Tuesday log for one branch contains four rows: TX41 at 9:10 for member 008 and book K; TX42 at 9:10 for member 008 and book K; TX41 at 9:10 for member 008 and book K; and TX43 at 9:18 for member 015 and book M. Which data transformation produces the most reliable checkout total for that day?

    • A

      Remove every transaction ID that occurs more than once, then count the remaining rows; the total is 2.

    • B

      Count every row in the log because each row represents a recorded checkout; the total is 4.

    • C

      Keep one row per distinct member, time, and book combination; the total is 2.

    • D

      Keep one row per distinct transaction ID, then count the IDs; the total is 3.

      Correct answer

    Explanation

    D is correct: the transaction ID identifies a successful checkout, so keeping one row per distinct ID removes the retry duplicate while preserving TX42, a separate checkout with the same member, time, and book details. There are 3 distinct IDs. C is incorrect because different transactions can share member, time, and book fields, so collapsing those rows can undercount. B is incorrect because a retried transmission creates an extra log row for TX41, inflating the total. A is incorrect because repeated appearance of an ID signals a duplicate row, not an invalid transaction; removing all rows with repeated IDs would discard the valid checkout TX41.

  5. Question 5

    An emergency-response agency combines dispatch logs from several regions. Each record stores a local date and time together with its UTC offset. Analysts want to calculate the elapsed time from dispatch to arrival for each incident and compare typical response times across regions. Which data transformation best supports a valid comparison?

    • A

      Convert each timestamp to UTC before calculating elapsed time, while retaining the original time and offset for local reporting.

      Correct answer
    • B

      Remove the UTC offsets and subtract the displayed clock times, since each record already uses a consistent time format.

    • C

      Group incidents by their recorded local dates and compare the displayed arrival times with the displayed dispatch times.

    • D

      Convert every timestamp using the offset from one selected region, so that all records follow the same regional clock.

    Explanation

    Timestamps with different UTC offsets can display different clock times for the same instant. Converting both dispatch and arrival timestamps to a common reference such as UTC before calculating each duration makes the calculations comparable; retaining the original values preserves useful context for local reporting.

    A is correct because it standardizes the instants before calculating elapsed time without discarding the original information.

    B is incorrect because equal-looking time formats do not make the timestamps comparable when their offsets differ.

    D is incorrect because applying one region’s offset to every record changes the represented instants for records from other regions.

    C is incorrect because local dates and clock times alone do not reliably establish elapsed duration across different offsets.

Frequently asked questions