9618/31

Computer Science 9618/31October/November 2021

Cambridge A-Level · Advanced Theory · worked solutions for every part, with the mark scheme

10
questions
75
marks
90
minutes

Topics Data Representation · Further Programming · System Software · Communication and Internet Technologies · Hardware and Virtual Machines · Security · +2 more

Q1Data RepresentationFree sample

(a) Numbers are stored in a computer using floating-point representation with:

• 12 bits for the mantissa
• 4 bits for the exponent
• two’s complement form for both the mantissa and exponent.

(a)
(i)

Write the normalised floating-point representation of the following unsigned binary number using this system.

1011100.011001

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

MantissaExponent
2M
DifficultyMedium
Worked solution

Working

1011100.011001 = 0.1011100011001 × 2^7

12-bit mantissa (including sign bit):
010111000110

4-bit exponent for +7:
0111

Answer

MantissaExponent
0101110001100111
Final answer

Mantissa 010111000110, Exponent 0111

Detailed explanation

Background Concept

In this floating-point system, a number is stored as two parts:

  • a mantissa
  • an exponent

Both are in two's complement form.

For Cambridge 9618 floating-point questions, the mantissa is treated as a signed binary fraction, so the binary point is immediately after the sign bit. A positive normalised mantissa therefore begins 01..., while a negative normalised mantissa begins 10....

Normalisation means shifting the binary point until the mantissa is in its standard form. The exponent records how many places the point was shifted.

Understanding the Question

You are given the unsigned binary number:

1011100.011001

and a floating-point format with:

  • 12 bits for the mantissa
  • 4 bits for the exponent
  • two's complement for both fields

The task is to rewrite the binary number in normalised floating-point form and then store:

  • the mantissa in exactly 12 bits
  • the exponent in exactly 4 bits

Approach

First, normalise the number so that it becomes a fractional mantissa multiplied by a power of 2.

Then:

  1. take the normalised mantissa
  2. store it in 12 bits, including the sign bit
  3. convert the exponent value into 4-bit two's complement

Because the original number is positive, the mantissa sign bit will be 0.

Step-by-Step Reasoning

Start with:

1011100.011001

To normalise it, move the binary point left until the value is of the form 0.1....

1011100.011001 = 0.1011100011001 × 2^7

Why exponent 7? Because the binary point has moved 7 places to the left.

Now store the mantissa.

The normalised mantissa is:

0.1011100011001

In this representation, the binary point is assumed after the sign bit, so for a positive number the stored mantissa begins with 0, followed by the fractional bits.

Available mantissa length = 12 bits total.
That means:

  • 1 sign bit
  • 11 more bits available

So we store:

0 10111000110

which gives:

010111000110

Now store the exponent.

Exponent = +7

In 4-bit two's complement, positive 7 is:

0111

So the final stored floating-point form is:

  • Mantissa: 010111000110
  • Exponent: 0111

Key Takeaways

  • In this syllabus, a normalised positive two's complement mantissa starts 01.
  • The exponent tells you how many places the binary point was shifted.
  • You must fit both parts into the exact number of bits given.
  • For a positive exponent in two's complement, ordinary binary can be used if it fits the range.

Common Mistakes

  • Writing the mantissa as if it were an integer rather than a signed fraction.
  • Forgetting that the mantissa length includes the sign bit.
  • Using the wrong exponent because of counting the binary-point shifts incorrectly.
  • Not normalising fully before storing the mantissa.
  • Writing too many mantissa bits instead of cutting it to 12 bits.

Things to Be Careful About

  • The 4-bit exponent range is -8 to +7, so +7 does fit.
  • The original number is unsigned and positive, so the mantissa sign bit is 0.
  • The stored mantissa must be exactly 12 bits long, not 13 or 14.
  • Do not include the binary point inside the bit field boxes; it is implied by the format.
Techniques used
shift the binary point to form a normalised mantissaencode the exponent in two's complementfit the value into the available mantissa bit length
(ii)

State the consequence of storing the binary number in part (a)(i) as a floating-point number in this system. Justify your answer.

Consequence ....................................................................................................................

...........................................................................................................................................

Justification .......................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

2M
DifficultyMedium-Easy
Worked solution

Answer

  • Consequence: loss of precision / rounding error.
  • Justification: the normalised mantissa is 0.1011100011001, but only 12 mantissa bits are available including the sign bit, so the last bits cannot be stored exactly. The stored value is 010111000110 × 2^7, so the original value is approximated.
Final answer

Loss of precision due to rounding/truncation because the mantissa is too short to store all bits exactly.

Detailed explanation

Background Concept

Floating-point numbers have limited precision because the mantissa has a fixed number of bits. If the number needs more significant bits than the mantissa can hold, some bits must be discarded. This causes a rounding error or truncation error.

This is different from overflow or underflow:

  • overflow happens when the exponent is too large to store
  • underflow happens when the exponent is too small to store
  • rounding error happens when the exponent fits, but the mantissa is not long enough for exact precision

Understanding the Question

You are asked what happens when the number from part (a)(i) is stored in this system, and you must justify your answer.

So this is not asking you to repeat the representation. It is asking whether storing it causes a problem such as:

  • exact storage
  • rounding error
  • overflow
  • underflow

You must decide which one applies and explain why.

Approach

Look at the two possible limits:

  1. Does the exponent fit in 4 bits?
  2. Does the mantissa fit exactly in 12 bits?

If the exponent fits but the mantissa does not, then the consequence is loss of precision rather than overflow.

Step-by-Step Reasoning

From part (a)(i), the normalised form is:

0.1011100011001 × 2^7

Now check the exponent first.

Exponent = +7

A 4-bit two's complement exponent can store values from -8 to +7, so +7 fits exactly.

So there is no overflow.

Now check the mantissa.

The mantissa bits needed are based on:

0.1011100011001

But only 12 bits are available in the mantissa field, including the sign bit.

That means only:

  • 1 sign bit
  • 11 remaining bits

can be stored.

So the stored mantissa becomes:

010111000110

This leaves off the final bits from the original normalised value. Therefore the number is not stored exactly.

So the consequence is loss of precision, because the computer must store an approximation.

Key Takeaways

  • Always separate range problems from precision problems.
  • If the exponent does not fit, think overflow or underflow.
  • If the mantissa does not fit exactly, think rounding or truncation error.
  • Floating-point values are often approximations, not exact values.

Common Mistakes

  • Saying overflow just because the number is large, without checking the exponent range.
  • Saying underflow even though the value is not extremely small.
  • Forgetting that the sign bit is part of the mantissa length.
  • Giving the consequence without any justification from the bit lengths.

Things to Be Careful About

  • In this question, the exponent is at its maximum positive value, but it still fits.
  • The justification must refer to the mantissa being too short, not just say "it is rounded" with no reason.
  • Use the normalised form when explaining precision, because that is what is actually stored.
Techniques used
compare required precision with available mantissa bitsidentify truncation of excess bitsjustify the storage consequence from the fixed format
(b)

Explain the reason why binary numbers are stored in normalised form.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................

3M
DifficultyMedium-Easy
Worked solution

Answer

  • Normalisation removes unnecessary leading 0s for positive numbers and unnecessary leading 1s for negative numbers.
  • This allows the maximum number of mantissa bits to be used for significant digits.
  • Therefore the value is stored with the greatest possible precision and in one standard form.
Final answer

Normalisation removes redundant leading bits so more mantissa bits store significant digits, giving maximum precision and a unique standard form.

Detailed explanation

Background Concept

Normalisation is the process of storing a floating-point mantissa in a standard form. In binary floating-point, this means shifting the binary point so that the mantissa begins with the correct leading bit pattern.

In two's complement floating-point:

  • a positive normalised mantissa begins 01
  • a negative normalised mantissa begins 10

This avoids wasting bits on repeated leading sign bits.

Understanding the Question

The question is asking for the reason computers store binary floating-point numbers in normalised form.

So the focus is not how to normalise a number, but why the system does it. The expected explanation is about efficient use of mantissa bits and improved precision.

Approach

To answer this well, explain three linked ideas:

  1. without normalisation, some leading bits are redundant
  2. removing those redundant bits frees space for useful significant bits
  3. this gives more accurate storage and a single standard representation

Step-by-Step Reasoning

Suppose a floating-point mantissa were not normalised. Then a positive value might begin with extra leading zeros, or a negative value might begin with repeated leading ones from sign extension.

Those leading bits do not add new information about the value. They are redundant.

If the number is normalised, the mantissa is shifted so that these redundant leading bits are removed as far as possible while keeping the correct sign pattern.

That means more of the available mantissa field is used for the actual significant part of the number.

More significant bits stored means greater precision.

Normalisation also gives a standard, unique way to store the value. Without it, the same number could be written in several different floating-point forms just by shifting the mantissa and changing the exponent.

So the main reasons are:

  • it avoids wasting bits
  • it maximises precision
  • it ensures a standard form

Key Takeaways

  • Normalisation makes best use of the mantissa field.
  • It improves precision because more significant digits are stored.
  • It also gives one standard representation for a value.
  • In two's complement floating-point, think in terms of removing redundant sign bits.

Common Mistakes

  • Saying normalisation is done to make the number smaller. That is not the point.
  • Talking only about moving the binary point, without explaining the benefit.
  • Forgetting that repeated leading 1s in negative numbers are also redundant.
  • Confusing normalisation with rounding.

Things to Be Careful About

  • The key idea is not just "standard form"; you should link it to precision.
  • In two's complement, the issue is redundant sign bits, not just leading zeros.
  • If a question asks for the reason, explain the advantage, not only the process.
Techniques used
explain the purpose of removing redundant leading bitsrelate normalisation to maximum mantissa precisiondescribe the benefit of a unique standard representation

The rest of this paper

9 more questions
  • Q2Further Programming4M
  • Q3Data Representation4M
  • Q4System Software7M
  • Q5Data Representation6M
  • Q6Communication and Internet Technologies8M
  • Q7Hardware and Virtual Machines10M
  • Q8Security6M
  • Q9Artificial Intelligence (AI)10M
  • Q10Computational Thinking and Problem-solving13M
Loading the full paper…