9.1 — Binary: How Numbers Live in Memory
All semester you have typed int and
float like they were words. Underneath, every one of
your coins, every xSpeed of 5, every cooldown of 2f is a stack of
bits — and once you can READ them, half the AP exam's data
questions become easy points.
Read the number 13 as eight bits of memory — and be able to say what every single bit is worth.
First, before anything else: cut that into parts small enough that you could look each one up on its own.
- Name the place valueswhat does this part do?Read: the place-value table in this lesson, in the Concept Lab
- Walk the places from largest to smallestwhat does this part do?Read: Step 2 of the Build Lab below
- Say why the hardware counts in twos and not tenswhat does this part do?Read: Binary & Hex, the unit reference page
- Work out how far a fixed width can reachwhat does this part do?Read: the byte-vs-int range discussion in the Concept Lab
- Recognise the edgewhat does this part do?Read: the overflow practice on the Exam Reference Sheet
The split is the whole lesson. "Convert 13 to binary" is one task you can only memorise; these five are five things you can look up, and the last two are the ones the exam actually asks about. Nothing here needs a variable — a bit width is a design decision you make once, and every later bug in this unit is that decision meeting a number that grew past it.
The test: could you explain this part to somebody using only a piece of paper? If a part needs Unity open to explain, it is not a part of this problem — it is a part of a coding problem.
Your turn
Pick two of the parts above and say in one line what each one actually does.
You want to store the number of lessons in the year, 81. Does it fit in 7 bits? Name the power of two that decides it, and say what that tells you about picking a width.
Unity spends a whole byte on a bool even though a bool is one bit. Is that waste a mistake? Argue one sentence for each side.
Checkpoint — before moving on, you must be able to:
- Convert any small decimal to binary and back, showing powers of two
- Explain WHY hardware uses base 2 (voltage states)
- Demonstrate int overflow and explain it with bits
- Say what a bool really costs and why range doubles per bit
Reference Docs
Need a deeper explanation? These pages cover the same concepts:
- Binary & Hex — the full reference with practice tables
- Exam Reference Sheet — binary on the AP exam
- Unit 9: Data & Systems — the whole map
Saved on this device only — the Dashboard tracks your progress.