Harmony Virtual Lab

Digital Technologies · Number bases and data representation

Binary, octal and hexadecimal

Flip eight bit-switches to see how computers store numbers, then hit target values in binary.

Start this experimentAll Digital Technologies experiments

Aim

To convert numbers between denary (base 10), binary (base 2), octal (base 8) and hexadecimal (base 16).

Apparatus

  • Eight switches and lamps (or this simulator)
  • Place-value chart

Theory

Computers store data as bits: 0 or 1. Eight bits make a byte. Each bit has a place value that doubles from right to left:

128 · 64 · 32 · 16 · 8 · 4 · 2 · 1

The denary value is the sum of the place values of the bits that are 1. One hexadecimal digit stands for four bits; one octal digit stands for three bits.

Procedure

  1. Flip a few switches and watch the denary, octal and hexadecimal values change.
  2. Read the target number.
  3. Set the switches so that the byte equals the target.
  4. Check and record, then take a new target.
  5. Try targets given in hexadecimal as well as denary.

What you do in the virtual lab

Set up the apparatus on screen, take readings and record them in a table (Target; Your binary; Denary; Octal; Hexadecimal; Check). Simulated instruments give slightly different readings each time, as real ones do. Finish with a short quiz; every answer is explained.

Teachers can set the experiment for a class, see each student’s results and use it as a WAEC- or NECO-style practical paper in exam practice.

Practice questions

  1. The binary number 1011 in denary is

    1. 9
    2. 13
    3. 11
    4. 1011
    Show the answer

    C. 11 8 + 0 + 2 + 1 = 11.

  2. The denary number 20 in binary is

    1. 10100
    2. 10010
    3. 11000
    4. 10110
    Show the answer

    A. 10100 20 = 16 + 4, so the 16s and 4s bits are 1: 10100.

  3. The hexadecimal digit F stands for the denary value

    1. 10
    2. 14
    3. 16
    4. 15
    Show the answer

    D. 15 Hexadecimal digits run 0–9 then A = 10 up to F = 15.

Do the experiment and the full quiz

Related Digital Technologies experiments

  • Logic gates and truth tablesDigital Technologies · SSS 1 – SSS 2Switch the inputs of AND, OR, NOT, NAND, NOR and XOR gates and build each truth table.
  • Programming a robot: sequence and loopsDigital Technologies · JSS 1 – SSS 1Write a program of moves and turns to steer a robot to its goal, then shorten it with a loop.
  • How strong is a password?Digital Technologies · JSS 1 – SSS 2Test made-up passwords, measure their strength in bits and see how long an attacker would need to guess them.
  • Spreadsheet formulas and functionsDigital Technologies · JSS 2 – SSS 2Use cell references, SUM, AVERAGE, MAX and IF to complete a shop sales record and a class result sheet.
  • Coding in PythonDigital Technologies · SSS 1 – SSS 3Write real Python – print, variables, loops and if statements – and have each program checked automatically.
  • Train a simple AIDigital Technologies · JSS 3 – SSS 3Teach a computer to tell ripe plantain from unripe by giving it labelled examples, then test how accurate it is.