In simple terms
A friendly intro before the formal notes — no formulas yet.
The Language of Computers
Computers only understand 'on' and 'off', represented by 1s and 0s (binary). We use clever systems to turn these simple signals into numbers, text, and all the complex data we use every day.
Imagine you only have a row of light switches. To represent the number 5, you could turn on the first and third switches (representing 1 and 4). To show the letter 'A', you might use a specific, agreed-upon pattern of on/off switches. Data representation is the set of rules for these patterns.
- 1
Denary ↔ binary using place value (powers of 2).
- 2
Hexadecimal: one digit = 4 bits — compact notation.
- 3
Characters stored as numeric codes (ASCII / Unicode).
- 4
Two's complement represents signed integers.
Explore the concept
Use the live diagram, PhET or GeoGebra sim, and synced steps — play it, drag controls, or tap a step.
Place value Each bit is worth double the one to its right, so the place values that are switched on add up to the denary number.
2 more simulations for this topic — run them in the Simulations section below
Simulations
Every simulation here runs the real model — try the steps on a card, then check what you see against the notes.
2 simulations
- GeoGebraCore
8-bit binary place-value table
Tap a bit to flip it and watch the place values add up to the denary total. Press +1 to count; ×2 and ÷2 move every bit one place.
D Stark · GeoGebra · GeoGebra Terms of Service
- GeoGebraCore9618 1.1
Character and Unicode code converter
Four boxes: type a character to get its code, a code to get its character, a word to get its list of codes, or a list of codes to get text.
Try this
- In Letter to Unicode type A, then a. Note 65 and 97: the cases differ by 32, a single bit.
- Type the digit 7. Its code is 55, not 7: the character and the number are stored differently.
- In Text to Unicode type your name and read one code per character.
Look for Text is stored as numbers. Every character has a fixed code, and the first 128 Unicode codes are the ASCII set, so ASCII text is also valid Unicode.
Steve Phelps · GeoGebra · GeoGebra Terms of Service
Full topic notes
Formal explanation with the rigour you need for the exam.
Number Systems: Denary, Binary, and Hexadecimal
We are accustomed to the denary (base-10) number system, which uses ten digits (0-9). Computers, however, operate on the binary (base-2) system, using only two digits: 0 and 1. Each digit in a binary number is a 'bit'. To make long binary strings more manageable for humans, we often use the hexadecimal (base-16) system. Hexadecimal uses 16 symbols: the digits 0-9 and the letters A-F (representing 10-15).
Each position in a binary number represents a power of 2 (e.g., ..., 128, 64, 32, 16, 8, 4, 2, 1).
Hexadecimal is a compact notation for binary. Each hexadecimal digit corresponds to a unique 4-bit binary sequence (a nibble).
For example, the hexadecimal digit is equivalent to the denary number 11, which is 1011 in binary.
A single byte (8 bits) can be represented by exactly two hexadecimal digits (e.g., 11111111₂ = FF₁₆ = 255₁₀).
Representing Negative Numbers: Two's Complement
Representing negative numbers in binary requires a special system. A simple approach might be to use one bit for the sign (e.g., 0 for positive, 1 for negative), known as sign-and-magnitude. However, this method has issues, including two different representations for zero (+0 and -0) and complex arithmetic logic. The standard method used by modern computers is Two's Complement. In this system, the most significant bit (MSB) of a number indicates its sign (0 for positive, 1 for negative), but it also carries a negative place value. This results in a single representation for zero and makes binary addition and subtraction straightforward for both positive and negative numbers.
To find the two's complement representation of a negative number (e.g., -X):
- Write the binary representation for the positive number (+X), ensuring it fills the required number of bits (e.g., 8 bits).
- Invert all the bits (change 0s to 1s and 1s to 0s). This is the one's complement.
- Add 1 to the result.
The range for an n-bit two's complement integer is from to .
Character Representation: ASCII and Unicode
Computers must also represent text. This is achieved by assigning a unique binary code to each character. A 'character set' is the collection of characters and their corresponding codes. The earliest widespread standard was ASCII (American Standard Code for Information Interchange), which uses 7 bits to represent 128 characters, including uppercase and lowercase English letters, numbers, and punctuation. Extended ASCII uses 8 bits for 256 characters. However, ASCII is insufficient for global languages. Unicode is the modern standard, designed to represent characters from virtually all writing systems. It can use up to 32 bits per character, allowing for over a million unique codes. UTF-8 is a popular and efficient way of encoding Unicode characters, using a variable number of bytes.
ASCII: 7-bit standard (128 characters), 8-bit extended (256 characters). Sufficient for English but not for world languages.
Unicode: A universal character set. Can represent over 1 million characters. Solves the limitations of ASCII.
Character sets map characters to unique integer values (code points). For example, in ASCII, 'A' is 65, which is 01000001 in binary.
The number of characters that can be represented is , where is the number of bits used per character.
Worked examples
See the formulas applied — reveal one step at a time, like the exam.
A computer stores a positive integer as an 8-bit binary number. Convert the denary number 173 into: (i) 8-bit binary, and (ii) hexadecimal.
- 1
(i) To convert 173 to binary, we find the largest power of 2 that fits into it and work down. Place values: 128, 64, 32, 16, 8, 4, 2, 1
Represent the denary number -58 as an 8-bit two's complement binary number.
- 1
Find the 8-bit binary for +58:
How it all connects
The big idea sits in the middle — tap a linked idea to explore the link.
Tap a linked idea to see how it connects back to the main topic — that connection is what examiners reward.
Glossary
Key terms for this topic — skim now; the Check step will test them.
- Bit
The smallest unit of data in a computer, representing a single binary value of either 0 or 1.
- Convert the 4-bit binary
(1 × 8) + (1 × 4) + (0 × 2) + (1 × 1) = 8 + 4 + 0 + 1 = 13.
- Two's Complement
A method for representing signed integers (positive and negative) in binary. The most significant bit (MSB) indicates the sign.
- In 8-bit two's
It signifies the sign. If the MSB is 0, the number is positive. If the MSB is 1, the number is negative.
- Overflow error
An error that occurs when the result of an arithmetic operation is too large to be stored in the number of bits allocated. For example, adding two positive 8-bit numbers and getting a result that requires 9 bits.
Quick check
Write your answer first, then compare it with the model one — the gap is what you would have lost.
Teach it back
If you can explain it simply, you own it — gaps here are marks you’d lose.
Teach it back
Explain this topic as if teaching a friend. We name the gaps an examiner would still dock.
Revision flashcards
Guess first, then flip — retrieval beats re-reading.
Key takeaways
Review these before you close the topic — retrieval beats re-reading.
Each position in a binary number represents a power of 2 (e.g., ..., 128, 64, 32, 16, 8, 4, 2, 1).
Hexadecimal is a compact notation for binary. Each hexadecimal digit corresponds to a unique 4-bit binary sequence (a nibble).
For example, the hexadecimal digit is equivalent to the denary number 11, which is 1011 in binary.
A single byte (8 bits) can be represented by exactly two hexadecimal digits (e.g., 11111111₂ = FF₁₆ = 255₁₀).
Practice — then mark it
The whole point: a real Cambridge question, marked mark-by-mark.
Test Your Knowledge on Data Representation
Test Your Knowledge on Data Representation
Extra simulations & links
PhET, GeoGebra and other curated tools — open in a new tab.
Frequently asked
Checkpoint
One marked question is worth ten re-reads — close the loop before you move on.
Reading it isn’t knowing it — prove it.
Before you move on: do Test Your Knowledge on Data Representation on paper, snap a photo, and get examiner-style feedback on exactly where you win and lose marks.
Discuss Data Representation
Ask, share and discuss with other Computer Science students