← Back to Lab
Computer Science · Topic 1 · Data representation

Binary & hex. Click the bits.

Click any bit to flip it and watch the denary and hexadecimal values update instantly. Shift left to double, shift right to halve, and see overflow happen exactly the way the examiner wants you to describe it.

0478 Topic 1 — Data representation binary ↔ denary ↔ hex · shifts · overflow · two's complement
8-bit register — click a bit cell to flip it between 0 and 1.

Interpretation

Denary
0
Hexadecimal
00
Binary
0000 0000
Bits set
0
Sum: 0
📋 Conversions (Cambridge method)
  • Binary → denary: add the place values (128, 64, 32, 16, 8, 4, 2, 1) of every bit that is 1.
  • Denary → binary: subtract the largest place value that fits, repeatedly, marking 1 for each used.
  • Binary → hex: split into two groups of 4 bits (nibbles); convert each nibble to one hex digit (10→A … 15→F).
  • Logical shift left multiplies by 2; shift right divides by 2 — bits that fall off the end are lost (precision/overflow).
  • Overflow: the result of an operation needs more bits than the register has — the value wraps or is wrong.
🧮 Two's complement
  • The leftmost bit is worth −128 instead of +128; the other place values stay positive.
  • A leading 1 therefore means the number is negative.
  • To negate a number: invert every bit, then add 1.
🎯 Syllabus reference (0478)
  • Topic 1 — Data representation: convert between binary, denary and hexadecimal; understand why hex is used (shorthand for binary); add 8-bit binary integers and identify overflow; perform logical shifts; represent negative numbers in two's complement.

Ask the lab assistant