9618/31

Computer Science 9618/31October/November 2023

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

12
questions
75
marks
90
minutes

Topics Data Representation · Hardware and Virtual Machines · System Software · Further Programming · Computational Thinking and Problem-solving · Communication and Internet Technologies · +1 more

Q1Data RepresentationFree sample

Real 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)

Write the normalised floating-point representation of +65.25 in this system.

Show your working.

MantissaExponent

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

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

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

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

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

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

3M
DifficultyMedium
Worked solution

Working

65.25 in binary is:

65.25=1000001.01265.25 = 1000001.01_2

Normalised form:

1000001.012=0.1000001012×271000001.01_2 = 0.100000101_2 \times 2^7

Mantissa (12 bits) = 010000010100

Exponent +7 in 4-bit two's complement = 0111

Answer

Mantissa: 010000010100

Exponent: 0111

Final answer

Mantissa 010000010100, Exponent 0111

Detailed explanation

Background Concept

A floating-point number is stored as two parts:

  • the mantissa (sometimes called the significand), which stores the significant digits
  • the exponent, which stores the power of 2 needed to scale the mantissa

In this question:

  • the mantissa uses 12 bits
  • the exponent uses 4 bits
  • both are stored in two's complement

For Cambridge normalised binary floating-point with a two's complement mantissa, the binary point is taken to be immediately after the sign bit. A normalised positive mantissa therefore begins 01..., and a normalised negative mantissa begins 10.... This is because the first two bits must be different in a normalised two's complement mantissa.

The exponent tells us how far the binary point has effectively been moved. With 4-bit two's complement, the exponent range is from -8 to +7.

Understanding the Question

You are asked to store +65.25 in this floating-point system and show the working. That means you must:

  1. convert 65.25 from denary to binary
  2. rewrite it in normalised floating-point form
  3. fit the mantissa into exactly 12 bits
  4. write the exponent in 4-bit two's complement

The important clue is the word normalised. A correct binary conversion alone is not enough; the mantissa has to be shifted into the standard normalised form.

Approach

The cleanest method is:

  1. Convert the whole-number part and fractional part separately into binary.
  2. Combine them into one binary number.
  3. Shift the binary point until the mantissa is in normalised form, with a positive mantissa starting 01....
  4. Count how many places you shifted: that becomes the exponent.
  5. Pad the mantissa with zeros to make exactly 12 bits.
  6. Convert the exponent to 4-bit two's complement.

Step-by-Step Reasoning

First convert 65.25 to binary.

1. Convert the integer part

65 = 64 + 1, so:

65=1000001265 = 1000001_2

2. Convert the fractional part

0.25 = \frac{1}{4}, so:

0.25=0.0120.25 = 0.01_2

So together:

65.25=1000001.01265.25 = 1000001.01_2

3. Normalise the number

We want the mantissa stored as a signed fraction, with the binary point after the sign bit. For a positive normalised mantissa, the bits should start 01....

Move the binary point left so the value becomes:

0.1000001012×270.100000101_2 \times 2^7

Check this:

  • the mantissa is 0.100000101
  • multiplying by 272^7 moves the point 7 places right
  • that gives back 1000001.01

So the exponent is +7.

4. Write the mantissa in 12 bits

The mantissa is 0.100000101.

In stored bit form, with the sign bit included and the binary point assumed after it, this is:

0100000101

Now pad with zeros on the right until there are 12 bits total:

010000010100

5. Write the exponent in 4-bit two's complement

The exponent is +7.

Positive two's complement numbers are written as ordinary binary with a leading 0, so:

+7 = 0111

6. Final representation

  • Mantissa: 010000010100
  • Exponent: 0111

That is the required normalised floating-point representation.

Key Takeaways

  • Convert the denary number to binary before trying to form the floating-point representation.
  • In this syllabus, a normalised two's complement mantissa has its binary point after the sign bit.
  • For a positive normalised mantissa, the first two bits are 01.
  • The exponent records how many places the binary point was shifted.
  • Always pad the mantissa to the exact number of bits given.

Common Mistakes

  • Writing the unnormalised binary number 1000001.01 directly into the mantissa field. The mantissa must be normalised first.
  • Forgetting that the mantissa is in two's complement form. For positive numbers this still affects the normalisation rule.
  • Using the wrong exponent because of miscounting the number of shifts.
  • Omitting trailing zeros in the mantissa. The field must contain exactly 12 bits.
  • Writing the exponent in plain binary without checking the bit length. It must be 4-bit two's complement.

Things to Be Careful About

  • The binary point is not stored explicitly; it is assumed to be after the sign bit of the mantissa.
  • Count mantissa bits carefully: the sign bit is part of the 12 bits.
  • Do not change the value when padding the mantissa; only add zeros to the right.
  • Check that the exponent +7 fits in the 4-bit two's complement range. It does, because the range is -8 to +7.
Techniques used
convert the denary value to binaryrewrite the binary number in normalised floating-point formpad the mantissa to the required bit lengthencode the exponent in two's complement
(b)

Explain the problem that will occur in storing the normalised floating-point representation of +65.20 in this system.

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

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

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

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

2M
DifficultyMedium-Easy
Worked solution

Answer

  • 65.20 has a fractional part of 0.20, which gives a recurring binary fraction.
  • Therefore the normalised mantissa cannot be stored exactly in 12 bits.
  • The value must be truncated or rounded, so the stored value is not exactly 65.20 and a rounding error occurs.
Final answer

Recurring binary fraction so the 12-bit mantissa cannot store it exactly; it must be rounded or truncated, causing a rounding error.

Detailed explanation

Background Concept

Not every denary fraction can be represented exactly in binary. Fractions such as 0.5, 0.25, and 0.75 terminate neatly in binary because they are sums of powers of 12\frac{1}{2}. But values like 0.2 often become recurring binary fractions.

A floating-point system only has a fixed number of bits available for the mantissa. If the binary fraction keeps going beyond the available bits, the computer has to:

  • truncate it, or
  • round it

Either way, the stored value is only an approximation. This creates a rounding error.

This is different from:

  • overflow: the value is too large for the available range
  • underflow: the value is too small in magnitude to be represented normally

Here, the problem is not range. It is precision.

Understanding the Question

The question asks what problem occurs when trying to store the normalised floating-point representation of +65.20 in this same system.

You are not being asked to produce the full bit pattern. Instead, you must explain why storing it exactly is a problem.

The key thing to notice is the decimal fraction .20. Many students recognise .25 as easy in binary, but .20 is the warning sign here: it does not terminate in binary.

Approach

To explain the problem clearly:

  1. Focus on the fractional part 0.20.
  2. Show that it becomes a recurring binary fraction.
  3. Link that to the fixed 12-bit mantissa length.
  4. Conclude that the number must be rounded or truncated, so the stored value is not exact.

That is the full chain of reasoning the mark scheme is looking for.

Step-by-Step Reasoning

Take the fractional part 0.20 and convert it to binary by repeated multiplication by 2:

  • 0.20 × 2 = 0.40 → next bit 0
  • 0.40 × 2 = 0.80 → next bit 0
  • 0.80 × 2 = 1.60 → next bit 1
  • keep the fraction .60
  • 0.60 × 2 = 1.20 → next bit 1
  • keep the fraction .20

Now we are back to 0.20, so the pattern repeats forever.

So:

0.2010=0.00110011001120.20_{10} = 0.001100110011\ldots_2

Therefore:

65.2010=1000001.001100110011265.20_{10} = 1000001.001100110011\ldots_2

When this is normalised, the repeating pattern is still there in the mantissa. But the mantissa has only 12 bits total, so there is not enough space to store the recurring fraction exactly.

That means the computer must cut it off or round it to the nearest representable value. So the stored value is slightly different from the true value 65.20.

This is a rounding error caused by limited precision.

It is worth noticing what the problem is not:

  • it is not overflow, because 65.20 is not too large for this exponent range
  • it is not underflow, because 65.20 is not close to zero

The problem is simply that the binary fraction does not terminate within the available mantissa bits.

Key Takeaways

  • Some denary fractions are recurring in binary.
  • A fixed-length mantissa cannot store a recurring binary fraction exactly.
  • When that happens, the value is rounded or truncated.
  • The result is a rounding error, not overflow or underflow.

Common Mistakes

  • Saying the problem is overflow. The value is well within range, so overflow is not the issue.
  • Saying the number cannot be stored because it is too big. The real problem is lack of precision, not lack of range.
  • Forgetting to mention that 0.20 becomes a recurring binary fraction.
  • Saying the computer stores it exactly after normalising. Normalisation does not remove the recurring fractional pattern.

Things to Be Careful About

  • Distinguish between range problems (overflow/underflow) and precision problems (rounding error).
  • The recurring part comes from the fractional component, not the whole-number part.
  • Even if the integer part is easy to store, the entire number may still be inexact because of the fractional part.
  • In exam answers, explicitly state both ideas: recurring binary fraction and rounding/truncation causing an inexact stored value.
Techniques used
convert a decimal fraction to binaryidentify a recurring binary fractionrelate limited mantissa length to loss of precisionexplain the resulting rounding error

The rest of this paper

11 more questions
  • Q2Communication and Internet Technologies6M
  • Q3Data Representation4M
  • Q4Data Representation6M
  • Q5Hardware and Virtual Machines4M
  • Q6Hardware and Virtual Machines6M
  • Q7System Software5M
  • Q8Data Representation · Further Programming8M
  • Q9System Software · Computational Thinking and Problem-solving9M
  • Q10Computational Thinking and Problem-solving10M
  • Q11Further Programming8M
  • Q12Artificial Intelligence (AI)4M
Loading the full paper…