AP CSP Unit 2: Binary and Data Representation
290 multiple-choice questions on AP Computer Science Principles Unit 2, Binary and Data Representation, organized by topic. They are not tied to any one class or teacher: they follow the College Board course framework. Learn the 30 key terms with the flashcards first, then test yourself. Every answer comes with a short explanation.
Take the practice test · Flashcards · All study tools
What it covers
- 2.1 Bits and binary numbers
- 2.2 Limits of representation
- 2.3 Analog and digital data
Key terms
2.1 Bits and binary numbers
- Nibble
- A group of 4 bits, equal to one hexadecimal digit
- Hexadecimal
- The base-16 number system using digits 0–9 and A–F
- ASCII
- A character encoding that maps common English letters, digits, and symbols to numbers stored in binary
- Unicode
- A character encoding that can represent letters and symbols from many writing systems
- Most significant bit
- The leftmost bit in an unsigned binary integer, which has the largest place value
- Least significant bit
- The rightmost bit in a binary integer, which has place value 1
- Bit pattern
- A specific sequence of 0s and 1s whose meaning depends on how a program interprets it
- Character encoding
- An agreed-upon mapping from characters to numbers that are then stored as bits
2.2 Limits of representation
- Unsigned integer
- A whole-number representation that uses all of its bits for magnitude and cannot store negatives
- Signed integer
- A whole-number representation that reserves a way to store negative values, shrinking the positive maximum
- Sign bit
- In a signed integer representation, the bit that distinguishes negative values from nonnegative ones
- Floating-point representation
- A way of storing real numbers with a fixed number of bits for a fraction and a magnitude
- Finite precision
- The limit that only a finite set of values can be stored exactly when a fixed number of bits is used
- Representable range
- The interval of values that a fixed-size representation can store
- Binary fraction
- A fractional value written with place values of 1/2, 1/4, 1/8, and so on
2.3 Analog and digital data
- Bit
- A binary digit, 0 or 1
- Byte
- 8 bits
- Binary
- The base-2 number system using digits 0 and 1
- Fixed-size integers
- Integers stored with a set number of bits, limiting their range
- Round-off error
- Imprecision from approximating real numbers with limited bits
- Analog data
- Data with continuously changing values
- Sampling
- Measuring an analog signal at discrete intervals
- Abstraction
- Reducing complexity by hiding details
- Digital data
- Data stored as a finite set of discrete values, typically sequences of bits
- Pixel
- One cell in the grid that makes up a digital image, with a stored color or brightness value
- RGB
- A common pixel encoding that stores separate intensities for red, green, and blue
- Color depth
- The number of bits used to store the color or brightness of one pixel
- Bit depth
- The number of bits used to store one sample, such as an audio amplitude or a pixel value
- Sampling rate
- The number of samples taken from an analog signal each second, or per unit of time
- Analog-to-digital conversion
- The process of sampling an analog signal, mapping each sample to a finite level, and storing those levels as bits
Sample practice questions
A bit is
- a group of 8 binary digits
- a single decimal digit, 0–9
- a binary digit, either 0 or 1
- a unit of processing time
Answer: C. a binary digit, either 0 or 1 Bit is short for binary digit. A byte is 8 bits.
Some programming languages represent integers using a fixed number of bits. This can cause
- overflow errors when results are too large to represent
- syntax errors when large numbers are typed into the code
- programs to run faster when working with large numbers
- automatic compression of data that uses large numbers
Answer: A. overflow errors when results are too large to represent Fixed-size integers have a maximum value.
Analog data
- have values that change smoothly rather than in discrete steps
- are always stored as sequences of 0s and 1s in a computer
- can't be measured, only estimated by human observers
- are only text, such as handwritten letters and notes
Answer: A. have values that change smoothly rather than in discrete steps Examples include sound waves, temperature and the position of a needle on a gauge.
How many bits are in a byte?
- 4
- 16
- 2
- 8
Answer: D. 8 One byte = 8 bits.
Real numbers stored in a computer can produce round-off errors because
- computers can't store decimal numbers at all, only whole numbers
- some numbers can't be represented exactly with a fixed number of bits
- binary numbers are always negative, so they must be rounded up
- round-off only happens on old computers with slow processors
Answer: B. some numbers can't be represented exactly with a fixed number of bits For example, 0.1 has no exact finite binary representation, so it is approximated.
Sampling is a technique used to
- compress text files by removing repeated characters and spaces
- approximate analog data digitally by measuring values at intervals
- encrypt messages so that only the intended recipient can read them
- send data over the internet in small packets along different routes
Answer: B. approximate analog data digitally by measuring values at intervals Digital audio samples a sound wave many times per second.
What is the decimal value of the binary number 1011?
- 13
- 9
- 11
- 1011
Answer: C. 11 8 + 0 + 2 + 1 = 11.
In many programming languages, the expression 0.1 + 0.2 == 0.3 evaluates to false because of
- round-off error in floating-point representation
- integer overflow in the addition of two numbers
- a syntax error in the way the decimals are written
- a logic error in the programmer's arithmetic
Answer: A. round-off error in floating-point representation The stored values are approximations, so the sum differs slightly from 0.3.
Increasing the sampling rate when digitizing sound
- reduces the file size, since each sample stores less information
- makes the digital copy closer to the original, but requires more data
- has no effect on quality, since sound is already stored in binary
- removes all background noise from the original analog recording
Answer: B. makes the digital copy closer to the original, but requires more data More samples capture more detail at the cost of storage.
What is 25 in binary?
- 11001
- 10011
- 11010
- 10101
Answer: A. 11001 25 = 16 + 8 + 1, so 11001.
More AP Computer Science Principles
- Unit 1: Creative Development
- Unit 3: Data Compression and Using Data
- Unit 4: Variables, Expressions, and Lists
- Unit 5: Iteration, Procedures, and Libraries
- Unit 6: Algorithms, Efficiency, and Simulations
- Unit 7: The Internet and Computer Systems
- Unit 8: Impact of Computing
- Unit 9: Legal, Ethical, and Safe Computing
Studying for a test in your own class? Make a practice test from your class notes.