Number Bases

4.5.2 (7 questions). Public Notes: AQA's A Level Computer Science

Convert 78 decimal into 8 bit unsigned binary.

  1. 78 - 64 = 14
  2. 14 - 8 = 6
  3. 6 - 4 = 2
  4. 2 - 2 = 0
  • 128 64 32 16 8 4 2 1
  • --0 -1 -0 -0 1 1 1 0
Answer: 01001110

Convert 10110010 binary to decimal.

  • 128 64 32 16 8 4 2 1
  • --1 -0 -1 -1 0 0 1 0
128 + 32 + 16 + 2 = 178

Convert 1101111 binary to hexadecimal.

  1. Split into nibbles (4 bits).
  2. 11011111 → 1101 + 1111

  3. Convert each nibble to decimal.
    • 8 4 2 1
    • 1 1 0 1
    • 8 + 4 + 1 = 13 decimal

    • 8 4 2 1
    • 1 1 1 1
    • 8 + 4 + 2 + 1 = 15 decimal

  4. Reference Legend.
  5. 10: A, 11: B, 12:C, 13:D, 14:E, 15:F

Answer: "DF" hexadecimal

Convert B2 hexadecimal to binary.

  1. Split apart hexadecimal characters.
  2. B2 = B + 2

  3. Convert each character to decimal using legend.
  4. B: 11 decimal, 2: 2 decimal

  5. Convert each decimal number to 4 bit binary.
  6. 11 → 4 bit binary

    • 8 4 2 1
    • 1 0 1 1

    2 → 4 bit binary

    • 8 4 2 1
    • 0 0 1 0

  7. Concatenate the two 4-bit binary strings.
  8. 1011 + 0010 → 10110010

Answer: 10110010

Convert A3 hexadecimal to decimal.

  1. Split apart hexadecimal characters.
  2. A3 → A + 3

  3. Convert each character to decimal using legend.
  4. A: 10 decimal, 3: 3 decimal

  5. Convert each decimal number to 4 bit binary.
  6. 10 decimal → 4-bit binary

    • 8 4 2 1
    • 1 0 1 0

    3 decimal → 4-bit binary

    • 8 4 2 1
    • 0 0 1 1

  7. Concatenate the two 4-bit binary strings.
  8. 1010 + 0011 → 10100011

  9. Convert 8-bit binary string into decimal.
    • 128 64 32 16 8 4 2 1
    • --1 -0 -1 -0 0 0 1 1
    • 128 + 32 + 2 + 1 = 163

Summary: hexadecimal → binary → decimal
Answer: 163

Convert 156 decimal to hexadecimal.

  1. Convert decimal to 8-bit binary.
    • 156 - 128 = 28
    • 28 - 16 = 12
    • 12 - 8 = 4
    • 4 - 4 = 0

    • 128 64 32 16 8 4 2 1
    • --1 -0 -0 -1 1 1 0 0

    Answer: 10011100

  2. Split 8 bit binary string into two 4-bit binary strings.
  3. 10011100 → 1001 + 1100

  4. Convert each nibble to decimal.
    • 8 4 2 1
    • 1 0 0 1
    • 8 + 1 = 9 decimal

    • 8 4 2 1
    • 1 1 0 0
    • 8 + 4 = 12 decimal

  5. Convert each decimal character to hexadecimal using legend.
    • 9 = 9 hexadecimal
    • 12 = C hexadecimal

Summary:decimal → binary → hexadecimal
Answer: 9C

Why is hexadecimal used in shorthand for binary.

  1. Simple to convert hexadecimal into binary
  2. Compact meaning hexadecimal can represent larger numbers using fewer characters
  3. Compact therefore Less likely for errors to be made in transcription
  4. Compact therefore Quicker to record