IB Computer Science A1.2: Data representation and computer logic
New IB Computer Science syllabus · first exams May 2027 · Theme A · SL & HL (all content)
A1.2 is one of the most practical, skills-based sub-units in the course. Expect questions that ask you to convert, calculate, construct and draw, not just describe.
| Statement | Topic | Command term |
|---|---|---|
| A1.2.1 | Representing data: binary and hexadecimal | Describe |
| A1.2.2 | How binary is used to store data | Explain |
| A1.2.3 | Purpose and use of logic gates | Describe |
| A1.2.4 | Truth tables (including Karnaugh maps) | Construct / Analyse |
| A1.2.5 | Logic diagrams | Construct |
Key points
A1.2.1 Binary, decimal and hexadecimal
- Binary (base 2): digits 0 and 1. Place values from the right: 1, 2, 4, 8, 16, 32, 64, 128. 8 bits = 1 byte (0–255).
- Hexadecimal (base 16): digits 0–9 and A–F (A = 10 … F = 15). One hex digit = 4 bits (a nibble), which makes hex a compact way to write binary, as in memory addresses and colour codes such as
#FF5733. - Worked example:
1011 0110= 128 + 32 + 16 + 4 + 2 = 182. Group it into nibbles,1011= B and0110= 6, so it's B6 in hex. Check: 11 × 16 + 6 = 182. - Decimal → binary: divide by 2 repeatedly and read the remainders from bottom to top.
A1.2.2 How binary stores data
The same bit pattern can mean a number, a character, a colour or part of a sound. Its meaning depends on the data type.
- Negative integers, two's complement: write the positive value, invert every bit, then add 1. −10 =
1111 0110. In 8 bits the range is −128 to +127, because the most significant bit carries a weight of −128. - Characters: ASCII is 7-bit with 128 characters ('A' = 65). Unicode (UTF-8) uses 1–4 bytes and covers every script and emoji.
- Images: a grid of pixels, each stored as a colour value. 24-bit colour = 8 bits each for red, green and blue. File size (bits) = width × height × bits per pixel.
- Audio: the sound wave is sampled at regular intervals. Size (bits) = sampling rate × bit depth × channels × seconds.
- Video: a sequence of image frames per second, which is why compression is essential.
A1.2.3 Logic gates
- AND: 1 only when all inputs are 1.
- OR: 1 when at least one input is 1.
- NOT: inverts its single input.
- NAND, NOR, XNOR: the opposite of AND, OR and XOR.
- XOR: 1 when the inputs are different.
- NAND and NOR are universal gates. Any circuit can be built from only one of them.
A1.2.4 Truth tables and Karnaugh maps
- A truth table has 2ⁿ rows for n inputs. Add intermediate columns, for example for (A AND B) and (NOT C), to show your working.
- Karnaugh maps simplify expressions:
- Use Gray code order for the columns (00, 01, 11, 10).
- Group the 1s into rectangles of 1, 2, 4 or 8. Groups can wrap around the edges.
- Make the groups as large as possible.
- Any variable that changes within a group drops out of that term.
A1.2.5 Logic diagrams and Boolean algebra
- Logic diagrams: draw them with standard gate symbols, inputs on the left and the output on the right. Label every input, gate and output.
- Boolean algebra simplifies circuits, which means fewer gates, lower cost and less power. Key laws:
- Identity: A·1 = A
- Complement: A + Ā = 1
- Distributive: A·(B + C) = A·B + A·C
- Absorption: A + A·B = A
- De Morgan's: NOT(A·B) = Ā + B̄
- Example: A·B + A·B̄ = A·(B + B̄) = A·1 = A.
Exam-style question
Convert the binary number 1101 0011 to (a) decimal and (b) hexadecimal. Show your working. [4]
Mark scheme
- (a) 128 + 64 + 16 + 2 + 1 = 211. [2]: working [1], answer [1].
- (b) Group into nibbles:
1101= D,0011= 3, so D3. [2]: one mark per correct nibble.
Common error: nibbles must be exactly 4 bits each, counted from the right.
Common mistakes that cost marks
- Forgetting to add 1 in two's complement, or not checking that a negative number's most significant bit is 1.
- Grouping nibbles from the left when the binary number isn't a multiple of 4 bits long.
- Leaving out intermediate columns in a truth table, which loses marks for working.
- Drawing gates in the wrong order. Follow the expression: evaluate the inner operations first.
- Unlabelled logic diagrams. Marks are awarded for each correctly drawn and labelled gate.
Frequently asked questions
Is A1.2 SL or HL?
Both. All of A1.2 is assessed at SL and HL.
Do I need to know Karnaugh maps and Boolean algebra?
Yes. Karnaugh maps and algebraic simplification are part of A1.2.4, and Boolean algebra rules are part of A1.2.5.
Which logic gates do I need to know?
All seven: AND, OR, NOT, NAND, NOR, XOR and XNOR, with their truth tables and standard symbols.
Go further
- Practise A1.2 with instant marking on ExamHaus. → examhaus.com
- Full A1.2 presentation and question bank with mark scheme on CS Exam Ready. → csexamready.com/resources/ib-diploma
- IB CS mock exams: Paper 1 & 2, SL & HL. → examhaus.com/mock-exams
