AP Computer Science Principles · Unit practice
AP Computer Science Principles Big Idea 2: practice questions
5 exam-style questions with answers and explanations. Answer them on FiveStudy to keep a streak and see your AP® score estimate.
Question 1
A library kiosk shows a small icon that is 5 pixels wide and 3 pixels tall. Every pixel of the icon is either black or white, and the kiosk stores each pixel as a single bit.
How many bits does the kiosk use to store the icon?
- A. 15
- B. 8
- C. 30
- D. 2
Answer: 15
The icon has 5 pixels in each of 3 rows, so it has 5 times 3 = 15 pixels. A pixel that is either black or white has two possible states, which is exactly what one bit (0 or 1) can record, so the 15 pixels are stored as 15 bits. The value 8 comes from adding the width and the height (5 + 3) instead of counting every pixel in the grid. The value 30 comes from giving each pixel two bits, one for each color, even though a single bit already distinguishes black from white. The value 2 is the number of colors a pixel can have, which is the number of states of one bit, not the number of bits in the whole icon.
Question 2
A weather station uses a single bit to record one fact about each day. Which of the following facts could a single bit record?
- A. The day's high temperature in whole degrees
- B. Whether any rain fell during the day
- C. Which of eight compass directions the wind blew from
- D. The number of minutes of sunshine the day had
Answer: Whether any rain fell during the day
One bit stores one of exactly two values, which matches a yes-or-no fact such as rain or no rain. Temperatures, eight directions, and minute counts each have many possible values, so they need more than one bit.
Question 3
Which of the following lists digital data from the lowest level of abstraction to the highest?
- A. A song file, then bytes, then bits
- B. Bytes, then a song file, then bits
- C. Bits, then bytes, then a song file
- D. Bits, then a song file, then bytes
Answer: Bits, then bytes, then a song file
Bits are the lowest level; grouped bits form bytes; higher-level structures such as files are built on top of bytes. Abstraction stacks upward from bits.
Question 4
A text message, a song, and a video are all saved on the same phone. Which of the following statements about how they are stored is true?
- A. Only the text message is actually stored using bits
- B. Each type of data is kept on its own special kind of storage chip
- C. The song is stored as sound waves rather than as digital data
- D. All three are stored as sequences of bits, using different encodings
Answer: All three are stored as sequences of bits, using different encodings
Different data types use different encoding schemes, but everything reduces to bits on the same storage. No separate chips or physical sound waves are involved.
Question 5
A weather station measures the outdoor temperature, which changes smoothly throughout the day. The station stores one sample at the end of every 10-minute period.
How many samples does the station store during a 2-hour period?
- A. 12
- B. 20
- C. 120
- D. 6
Answer: 12
Sampling measures an analog value at regular intervals. Two hours is 120 minutes, and the station stores one sample for each 10-minute period, so it stores 120 / 10 = 12 samples. The value 20 comes from multiplying the 2 hours by the 10-minute interval, which mixes two different units and does not count the periods. The value 120 is the number of minutes in 2 hours, which would be the count only if a sample were stored every minute. The value 6 is the number of samples stored in a single hour (60 / 10), so it leaves out the second hour.
More AP Computer Science Principles practice