Computer ScienceExam code: 0984

Number Systems

Data Representation

Denary to binary

The standard method is the place-value table:

  1. Write a row of place-value headings (1, 2, 4, 8, 16, 32, 64, 128) from right to left.
  2. Working from the left of the table, ask: does the largest column heading fit into the denary number? If yes, write a 1 under it and subtract that value from the denary number. If no, write a 0.
  3. Move to the next column heading and repeat with the remainder.
  4. Continue until you reach the rightmost column.
  5. The string of 1s and 0s along the bottom is the binary value.

Binary to denary

The reverse is simpler:

  1. Write the binary number under a row of place-value headings.
  2. For every column that has a 1, write down the column heading.
  3. Add them all up.

Common exam question

Converting between denary and binary

Question: Convert one or more denary numbers to binary, or a binary number to denary, sometimes as the contents of an 8-bit register (1–3 marks).

Asked in 8 of the 17 papers, every Paper 1 but one. Each converted number is one mark, so three numbers are three marks. When the question says to show your working the conversion is worth two: one for a valid method, such as the place values that add up to the number, and one for the answer, so write the place values down even when you can do it in your head.

Most schemes bracket leading zeros in a plain conversion, but one printed them without brackets, and a register or an 8-bit answer must show all eight bits, so pad every binary answer to eight bits: 9 goes in as 00001001. A binary-to-denary conversion is one mark for the value, so check the addition of the place values under the 1s.

Worked example

Converting denary to binary

Convert the denary number 201 to 8-bit binary.

Solution:

  • Write the 8-bit place-value headings: 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1
  • 201 ≥ 128? Yes → write 1, remainder = 201 − 128 = 73
  • 73 ≥ 64? Yes → write 1, remainder = 73 − 64 = 9
  • 9 ≥ 32? No → write 0
  • 9 ≥ 16? No → write 0
  • 9 ≥ 8? Yes → write 1, remainder = 9 − 8 = 1
  • 1 ≥ 4? No → write 0
  • 1 ≥ 2? No → write 0
  • 1 ≥ 1? Yes → write 1
  • Result: 11001001

Quick check

3 short questions on this note. See what has stuck, and where to look if something hasn't.

About 1 minute

Build on this topic