Atlas登入
Black FridayHalf off Premium, through Sunday, Nov 29.See plans
AP Computer Science Principles · Unit test

Data practice test

Up to 15 AP Computer Science Principles questions on data, timed at the exam's pace and scored, new every time. Try 3 below first.

Take the data unit test →Try 3 questions

Data is 17%–22% of the AP Computer Science Principles exam's multiple choice. Learn it first in the data chapter.

3 free data practice questions

Real questions from the Atlas AP Computer Science Principles exam pool, with the answer and the working.

  1. Which of the following numbers has the greatest value?

    1. Abinary 1101100
    2. Bbinary 1011110
    3. Cdecimal 101
    4. Ddecimal 99
    Show the answer

    A.

    Convert the binary numbers with place values 1, 2, 4, 8, … from the right: 1101100 = 108 and 1011110 = 94. Of 108, 94, 101, 99, the greatest is 108, so binary 1101100 is the answer.

    Comparing binary numbers by their digits as if they were decimal, or reading the bits from left to right as the ones place, picks the wrong number; only the place values decide.

  2. A weather station stores its daily high temperatures in the list temps.

    temps ← [61, 45, 43, 56, 51, 46, 56, 56]
    count ← 0
    total ← 0
    FOR EACH t IN temps
    {
      IF(t ≥ 51)
      {
        count ← count + 1
        total ← total + t
      }
    }
    DISPLAY(total / count)

    What is displayed as a result of executing the code segment?

    1. A35
    2. B51.75
    3. C56
    4. D57.25
    Show the answer

    C.

    The IF selects the readings at or above 51: 61, 56, 51, 56, 56. So count is 5, total is 280, and 280 / 5 = 56 is displayed.

    35 divides the total by the length of the whole list instead of by count; 51.75 is the average of every reading, ignoring the IF; 57.25 leaves out the readings equal to 51 (treats ≥ as >).

  3. A hospital wants to reduce the storage space used by its digital X-ray images. Doctors must be able to view each image exactly as it was originally recorded. Which of the following is the best choice?

    1. ALossy compression, because it reduces the number of bits while allowing the original image to be completely restored
    2. BLossless compression, because it always reduces the number of bits more than lossy compression does
    3. CLossy compression, because it removes only the image’s metadata and leaves the pixels unchanged
    4. DLossless compression, because it reduces the number of bits while allowing the original image to be completely restored
    Show the answer

    D.

    Lossless compression reduces the number of bits without losing information, so the original can be reconstructed exactly, which is what the doctors need.

    Lossy compression throws information away, so the original cannot be fully restored; lossy compression usually saves more space than lossless, not less; and lossy compression changes the data itself, not just the metadata.

Take the full unit test →AP Computer Science Principles practice exam

Questions people ask

What is in the AP Computer Science Principles Data practice test?
Up to 15 multiple-choice questions from this unit, plus a free-response question when the unit has one, timed at the real exam's pace and scored as a percent. The questions are new every time, drawn from a pool of checked questions.
How much of the AP Computer Science Principles exam is Data?
17% to 22% of the multiple-choice questions, by the College Board’s course and exam description.
Is it free?
The 3 questions on this page need no account. With a free Atlas account your first unit test is free; Atlas Premium has no limit.

Other AP Computer Science Principles units