A-Level Computer Science: Binary Arithmetic, Fixed and Floating Point

This material trains the numerical side of data representation in A level Computer Science: the calculations that have to be done by hand, without a calculator, in the written papers. It is for Year 12 and Year 13 students who already know how to convert small binary numbers and want to be secure with everything built on top of that.

The quiz has twelve questions and every one is a calculation. It starts with a three-digit hexadecimal conversion and an unsigned 8-bit addition whose result needs a ninth bit, so the student has to say what the register actually holds. A two's complement subtraction is done the way a processor does it, by adding the negated number. Two questions compare shifts: a logical left shift that multiplies by four, and an arithmetic right shift that halves a negative number while keeping its sign. A mask question uses XOR to toggle four bits. Two fixed-point questions read an unsigned value and a two's complement value with four fraction bits. The last four use one clearly stated floating-point format (an 8-bit two's complement mantissa and a 4-bit two's complement exponent): spotting a normalised mantissa, normalising a number, decoding a negative value and adding two numbers with different exponents.

Every explanation shows the full working and a check, and says what the tempting wrong answer forgot, such as the negative weight of the sign bit or the need to line up exponents before adding.

The flashcards cover why hexadecimal is used, sign and magnitude, negating in two's complement, range and overflow, logical and arithmetic shifts, the three mask operations, fixed-point binary, why 0.1 is not exact, normalisation, the range and precision trade-off and the steps of floating-point addition.

The written work has eight longer tasks to answer on paper: a 12-bit conversion to hexadecimal and denary, a two's complement subtraction with a check, an overflow example and how a processor detects it, a fixed-point representation with an explanation of rounding, representing −6.5 as a normalised floating-point number, normalising a negative number and showing its value is unchanged, using masks and shifts on a byte of settings, and comparing two ways of splitting 16 bits between mantissa and exponent. Each task has a model answer and the points a marker would look for.

There is also a short oral practice with an examiner, who states each number format in full, asks one question at a time and gives brief feedback at the end.

The content is based on the data types and number representation sections of the A level specifications, for example OCR H446 section 1.4.1 (including floating-point addition, bitwise masks and shifts) and AQA 7517 section 4.5.4 (fixed and floating point, normalisation, range and precision).

  • Convert between hexadecimal, binary and denary
  • Add and subtract in unsigned binary and two's complement, and recognise overflow
  • Apply logical and arithmetic shifts and AND, OR and XOR masks
  • Read and write unsigned and two's complement fixed-point values
  • Decode, normalise and add floating-point numbers with a two's complement mantissa and exponent
  • Explain the trade-off between range and precision

Practice material written by Zestly, based on the number representation content of the A level Computer Science specifications (for example OCR H446 section 1.4.1 and AQA 7517 section 4.5.4).

Sample question

Two unsigned 8-bit numbers, 10110110 and 01101101, are added in an 8-bit register. What does the register hold afterwards, and what has happened?

See the answer

00100011, and a carry out of the most significant bit shows overflow

182 + 109 = 291, which is 100100011 in binary and needs nine bits. An 8-bit register keeps only the lowest eight bits, 00100011 (35); the ninth bit is a carry out, which signals overflow for unsigned numbers, so the stored result is wrong.

← Computer Science

↑ A-Level