← IB Computer Science

Data representation and computer logic

Everything a computer stores is binary. This unit covers binary and hexadecimal numbers, how integers and characters are encoded, and how logic gates and truth tables turn those bits into decisions.

Slide 1 / 4

Number systems: binary and hexadecimal

Binary and hexadecimal4 bitshexdec0000000001110110661001991010A101101D131111F151 hex digit = 1 nibble (4 bits)Reading binary 1 0 1 1 01160814120116 + 4 + 2 = 22Add the place values of every bit set to 1
  • Computers store all data in binary (base 2), using bits that are either 0 or 1.
  • Hexadecimal (base 16) uses the digits 0 to 9 and then A to F, where A is 10 up to F is 15.
  • Hexadecimal is shorthand for binary: each hex digit maps to exactly four bits (a nibble), so 1101 is D and 0110 is 6.
  • To read a binary value, add the place values of the bits that are 1. For example 10110 is 16 plus 4 plus 2, which is 22.

Check you've got it

0/4

1. What is the denary (decimal) value of the binary number 10110?

2. What is the hexadecimal equivalent of the 8-bit binary number 11010110?

3. Which logic gate outputs 1 only when its two inputs are different?

4. What range of values can a 4-bit two's complement integer represent?

Free revision content. Multiple-choice answers are marked instantly. Written answers are marked by AI on /free-mark.