AP Computer Science Principles Big Idea 2: Data Practice Questions
Practice questions for AP Computer Science Principles Big Idea 2 (Data), covering binary numbers, data compression, and data analysis, with explanations for every answer.
Questions
What is a bit?
- A single binary digit, either 0 or 1
- A group of eight binary digits that represents one character
- The smallest unit of data that a hard drive can physically store, holding one letter
- A decimal digit from 0 to 9
How many bits are in a byte?
- 8
- 4
- 10
- 16
What decimal value does the binary number 1011 represent?
- 11
- 13
- 9
- 1011
What decimal value does the binary number 11010 represent?
- 26
- 24
- 22
- 13
What decimal value does the binary number 101010 represent?
- 42
- 21
- 40
- 84
What is the decimal number 37 written in binary?
- 100101
- 100011
- 101001
- 110101
What is the decimal number 64 written in binary?
- 1000000
- 100000
- 111111
- 10000000
What is the largest decimal value that can be represented with 8 bits (unsigned)?
- 255
- 256
- 128
- 127
How many different values can be represented with 5 bits?
- 32
- 31
- 25
- 10
What is the minimum number of bits needed to give each of 50 students a unique ID?
- 6
- 5
- 7
- 50
What is the minimum number of bits needed to represent 300 different values?
- 9
- 8
- 10
- 300
If one bit is added to a fixed-length binary number, how does the number of values it can represent change?
- It doubles
- It increases by exactly one
- It increases by ten, just as adding a decimal digit would
- It stays the same
Which list is in order from least to greatest?
- Binary 0110, decimal 7, binary 1001
- Decimal 7, binary 0110, binary 1001
- Binary 1001, decimal 7, binary 0110
- Binary 0110, binary 1001, decimal 7
Which value is the greatest?
- Binary 10110
- Decimal 21
- Binary 1111
- Decimal 20
The binary number 10000000 equals 128 in decimal.
The binary number 1111 equals 16 in decimal.
Adding a 0 to the right end of a binary number doubles its value.
Convert the binary number 1001 to decimal.
Convert the decimal number 19 to binary.
Convert the binary number 1100100 to decimal.
How many different values can 10 bits represent?
What is the decimal number 45 written in binary?
- 101101
- 110101
- 101011
- 100101
What is the decimal number 200 written in binary?
- 11001000
- 11000100
- 10101000
- 11100000
Why do computers use binary to represent data?
- Their circuits reliably distinguish two states, such as on and off
- Binary numbers are always shorter than decimal numbers
- Binary is the only number system that can represent fractions
- Humans find binary easier to read than decimal
The same sequence of bits can represent a number, a letter, or part of an image. What determines which?
- How the program interprets the bits
- The order in which the bits were stored on the device's drive
- Whether the bits are mostly 0s or mostly 1s
- The physical size of the storage device
A sequence of bits can represent different kinds of data depending on how it is interpreted.
What is abstraction in the context of representing data in binary?
- Letting people work with numbers, text, and images instead of raw bits
- Converting every number into a decimal value before storing it
- Deleting the unneeded bits from every file so that the files become smaller
- Encrypting data so that it cannot be read
A program stores whole numbers using a fixed 4 bits. What happens if it tries to store 18?
- An overflow error occurs
- The value is stored correctly as 10010
- The value is automatically rounded to 15 and stored correctly
- The program converts 18 into a decimal string
Why might 0.1 + 0.2 produce 0.30000000000000004 in a program?
- Some decimal fractions cannot be stored exactly in binary
- The program is using lossy compression on numbers
- Adding two decimals always causes an overflow error in any language
- The computer randomly adds small amounts to results
Programs that store real numbers with a fixed number of bits may produce small rounding errors.
In some programming languages, integers can grow as large as memory allows.
What is analog data?
- Data with values that change continuously
- Data that has already been converted into bits
- Data stored only on old devices, such as cassette tapes or vinyl records
- Data that contains errors
How is analog data, such as sound, typically converted to digital data?
- By measuring its value at regular intervals
- By compressing it with a lossless algorithm before it is recorded
- By converting each sound wave into a decimal string
- By deleting the quiet parts
A sound is recorded with more samples per second. What is the most likely result?
- A more accurate recording that uses more storage
- A less accurate recording that uses less storage
- No change in accuracy or storage
- A recording that can no longer be played back
A digital representation of analog data is an approximation of the original.
Which are examples of analog data?
- The changing volume of a live voice
- The position of a clock's sweeping second hand
- Outdoor temperature over a day
- A text message
- An MP3 file
A color is stored as three values (red, green, blue), each using 8 bits. How many bits does one color use?
- 24
- 8
- 3
- 256
A black-and-white image stores each pixel as 1 bit. How many bits are needed for an 8 × 8 image?
- 64
- 16
- 8
- 128
Explain why a fixed number of bits can lead to both overflow errors and rounding errors.
What is lossless compression?
- Compression that allows the original data to be restored exactly
- Compression that permanently removes some details to save space
- Compression that makes files larger
- Compression that only works on images
What is lossy compression?
- Compression that discards some data, so the exact original cannot be restored
- Compression that always restores every bit of the original data
- Compression that encrypts data
- Compression that only works on text
Which type of compression usually reduces file size more?
- Lossy
- Lossless
- Both always reduce size by exactly the same amount
- Neither ever reduces file size
A hospital sends medical scans that doctors use for diagnosis. Which compression is most appropriate?
- Lossless
- Lossy, because smaller files are always better for every purpose
- Lossy, because doctors can't see fine details
- No compression is possible for images
A video service wants to stream movies quickly to phones. Which compression is most appropriate?
- Lossy
- Lossless, because it always produces the smallest files possible
- Lossless, because video cannot be compressed in a lossy way
- Neither, because compression slows streaming
A programmer compresses a source code file before emailing it. Which compression must be used?
- Lossless
- Lossy, since code files are too small to need exact restoration
- Lossy, since text compresses better that way
- Either one; the result is the same
Using run-length encoding, how might the string AAAABBBCC be compressed?
- 4A3B2C
- ABC
- A4B3C2C
- 9ABC
Run-length encoding works best on which kind of data?
- Data with long runs of repeated values
- Data in which no value ever repeats
- Data that has already been compressed
- Data that is analog
Lossless compression can always reduce the size of any file.
With lossy compression, the original file cannot be perfectly reconstructed.
Compressing a file with a lossless algorithm and then decompressing it gives back exactly the original file.