Data Representation and Computer Logic (IB CS A1.2): A Complete Guide
IB Computer Science A1.2 explained: binary, denary, hex, ASCII and Unicode, image and sound encoding, logic gates, truth tables, and Karnaugh maps (HL).

Underneath every photo, song, and chat message is the same raw material: bits. A computer never stores the letter "A" or a sunset; it stores patterns of 0s and 1s and relies on agreed rules to turn those patterns back into meaning. Topic A1.2 teaches you both halves of that story: the encoding rules and the logic that acts on them.
This guide covers every A1.2 understanding with worked conversions and the gate logic you need for Paper 1, and it flags clearly where the Karnaugh map content is HL only.

What does IB CS topic A1.2 cover?
A1.2 has five syllabus understandings: the principal methods of representing data (binary, denary, and hexadecimal), how binary is used to store integers, text, images, and sound, the purpose and use of logic gates, how to construct and analyse truth tables, and how to construct logic diagrams. At HL you also simplify Boolean expressions using Boolean algebra and Karnaugh maps. In short: how computers write data down, and how circuits make decisions about it.
How do you convert between binary and denary?
Binary is base 2: each column is a power of 2, doubling from right to left (1, 2, 4, 8, 16, and so on). Denary is the everyday base 10 system.
To convert binary to denary, line the bits up under their place values and add the columns where a 1 appears.
Worked example: 10011010 to denary
Place the bits under 128, 64, 32, 16, 8, 4, 2, 1. The 1s sit under 128, 16, 8, and 2.
128 + 16 + 8 + 2 = 154
To convert denary to binary, repeatedly divide by 2 and read the remainders from the bottom up.
Worked example: 45 to binary
45 / 2 = 22 remainder 1
22 / 2 = 11 remainder 0
11 / 2 = 5 remainder 1
5 / 2 = 2 remainder 1
2 / 2 = 1 remainder 0
1 / 2 = 0 remainder 1
Read the remainders upward: 101101. Pad to a full byte and you get 00101101.
What is hexadecimal and why is it used?
Hexadecimal is base 16. It uses the digits 0 to 9 and then the letters A to F, where A is 10, B is 11, up to F which is 15. Its superpower is that each hex digit maps exactly to four bits, a group called a nibble, so converting between binary and hex is almost mechanical.
Split 10011010 into two nibbles, 1001 and 1010. The first nibble is 9 and the second is A, so the byte is 0x9A. That gives one clean identity: 10011010 in binary equals 154 in denary equals 9A in hex.
Programmers reach for hex because it is far more readable than long binary strings while still mapping cleanly onto bits. You will see it in memory addresses such as 0x7FFE0034 and in colour codes such as #6B5CD3.
How does a computer store text, images, and sound?
Every data type becomes binary; only the encoding rule changes.

Text is stored character by character. ASCII uses one byte per character, so the letter A is code 65, or 01000001 in binary. Unicode, usually delivered as UTF-8, uses one to four bytes per character so it can represent every writing system, symbol, and emoji.
Images are grids of pixels. Each pixel stores a colour value, and the number of bits per pixel is the colour depth. With 24-bit colour, eight bits each describe the red, green, and blue channels. The resolution is the width times height in pixels, and an uncompressed file size is roughly width times height times colour depth.
Sound is captured by sampling: measuring the amplitude of the wave many times per second. The sampling rate in hertz sets how often you measure, and the bit depth sets how many amplitude levels each sample can take. CD audio uses a 44.1 kHz sampling rate and 16-bit depth.
What are logic gates?
A logic gate takes one or more binary inputs and produces a single binary output. They are the building blocks of every circuit in the ALU, and the IB expects you to know six of

AND outputs 1 only when both inputs are 1.
OR outputs 1 when at least one input is 1.
NOT inverts a single input.
NAND is AND followed by an inversion, shown by a bubble on the output.
NOR is OR followed by an inversion.
XOR outputs 1 only when the two inputs are different.
A small bubble on a gate's output always means "then invert", which is why NAND and NOR are just AND and OR with a bubble.
How do you build a truth table?
A truth table lists every possible input combination and the output the circuit produces for each. With two inputs there are four rows, with three inputs there are eight, following 2 to the power of the number of inputs.
Worked example: alarm that needs two sensors
A security alarm should sound only when a motion sensor (A) and a door sensor (B) are both triggered. That is an AND gate, so Q is 1 only on the final row.
A | B | Q = A AND B |
|---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
Work the table left to right, one column at a time, and never assume the output before you have checked every row.
How do you simplify logic with Boolean algebra and Karnaugh maps? (HL only)
At HL you simplify expressions so a circuit uses fewer gates. Boolean algebra applies rules such as A AND 1 = A, A OR 0 = A, and the identity A OR (A AND B) = A to reduce an expression by hand.
A Karnaugh map is a grid version of a truth table whose rows and columns are arranged in Gray code so that neighbouring cells differ by exactly one variable. You group adjacent 1s into blocks of 1, 2, 4, or 8, and each group collapses to a simpler term. K-maps are usually used with up to four variables, and they make simplification far less error-prone than algebra alone.
Common exam mistakes for IB CS A1.2
Misreading binary place values, or forgetting to pad an answer to a full 8-bit byte when the question asks for one.
Treating hex as a separate number system rather than a compact way of writing binary in nibbles.
Confusing resolution (pixel dimensions) with colour depth (bits per pixel).
Saying a higher sampling rate makes sound louder. Sampling rate captures higher frequencies; bit depth sets amplitude precision.
Reading logic diagrams right to left. Always read left to right unless told otherwise.
Mixing up NAND and NOR, or assuming XOR behaves like OR.
Quick recap of A1.2
Data is represented in binary (base 2), denary (base 10), and hexadecimal (base 16), where one hex digit equals one nibble.
Binary stores everything: ASCII and Unicode for text, pixels and colour depth for images, sampling rate and bit depth for sound.
Logic gates (AND, OR, NOT, NAND, NOR, XOR) each turn binary inputs into one binary output.
A truth table lists every input combination, with 2 to the power n rows.
Logic diagrams wire gates together to implement an expression.
HL only: simplify circuits with Boolean algebra and Karnaugh maps.
Frequently asked questions
How do you convert binary to denary?
Write the binary number under the place values 128, 64, 32, 16, 8, 4, 2, 1, then add the place values of every column that contains a 1. For example, 10011010 gives 128 + 16 + 8 + 2 = 154.
What is a nibble in computer science?
A nibble is a group of four bits, which is exactly half a byte. It matters because one nibble maps to a single hexadecimal digit, making binary-to-hex conversion quick and reliable.
Why do programmers use hexadecimal instead of binary?
Hexadecimal is base 16, and each hex digit represents four bits, so it expresses the same value as binary in a quarter of the characters. That makes memory addresses and colour codes far easier to read while still mapping cleanly onto the underlying bits.
What is the difference between sampling rate and bit depth?
Sampling rate is how many times per second the sound wave is measured, set in hertz, and it controls how much detail and how many frequencies are captured. Bit depth is how many possible amplitude levels each sample can take, and it controls the precision of each measurement.
What is the difference between a NAND gate and a NOR gate?
A NAND gate is an AND gate with its output inverted, so it outputs 0 only when both inputs are 1. A NOR gate is an OR gate with its output inverted, so it outputs 1 only when both inputs are 0. The bubble on the symbol marks the inversion in each case.
Are Karnaugh maps HL only in IB Computer Science?
Yes. Constructing and analysing truth tables and logic diagrams is required at both SL and HL, but simplifying expressions with Boolean algebra and Karnaugh maps is part of the HL-only content in A1.2.
Looking for a printable summary? Grab the A1.2 Shuttle Learning revision sheet, a three-page knowledge organiser covering everything above.
Looking for an IB Computer Science tutor?
Hi, I'm Yuness, the tutor behind Shuttle Learning. I work one to one with IB Computer Science students at SL and HL, and I deliberately take on only a handful each year so every student gets my full attention. Most go on to earn the 6s and 7s they were aiming for, in the final exams and the IA alike.
If you would like that kind of support, book a free 15-minute call and tell me what you are stuck on. You can press BOOK A LESSON .