9618/33

Computer Science 9618/33May/June 2021

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

9
questions
75
marks
90
minutes

Topics Data Representation · System Software · Computational Thinking and Problem-solving · Artificial Intelligence (AI) · Communication and Internet Technologies · Hardware and Virtual Machines · +1 more

Q1Data RepresentationFree sample

Real numbers are stored in a computer system using floating-point representation with:

• 10 bits for the mantissa
• 6 bits for the exponent
• Two’s complement form for both the mantissa and the exponent.

(a)

Calculate the normalised floating-point representation of –7.25 in this system.
Show your working.

MantissaExponent

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

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

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

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

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

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

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

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

3M
DifficultyMedium
Worked solution

Working

7.25 = 111.01

Normalised value:

-111.01 = -0.11101 × 2^3

Positive mantissa:

0.111010000 = 0111010000

Two's complement for negative mantissa:

1000110000

Exponent 3 in 6-bit two's complement:

000011

Answer

Mantissa: 1000110000

Exponent: 000011

Final answer

Mantissa 1000110000, Exponent 000011

Detailed explanation

Background Concept

In this floating-point format, the number is split into a mantissa and an exponent. The mantissa stores the significant bits of the number, and the exponent stores how far the binary point has been shifted.

For this question:

  • the mantissa has 10 bits
  • the exponent has 6 bits
  • both use two's complement

With Cambridge floating-point questions, the binary point is taken to be immediately after the sign bit of the mantissa. So a positive normalised mantissa starts 01... and a negative normalised mantissa starts 10.... That is the sign that the value has been normalised correctly.

Because the mantissa is in two's complement, a negative mantissa is not written with a minus sign. Instead, you write the positive bit pattern and then take its two's complement.

Understanding the Question

You are asked to store -7.25 in this exact floating-point system.

That means you must:

  1. convert 7.25 to binary
  2. write it in normalised form
  3. encode the mantissa in 10-bit two's complement
  4. encode the exponent in 6-bit two's complement

The wording "Show your working" means the conversion steps matter, not just the final pair of bit strings.

Approach

Start by converting the denary value to binary:

  • integer part 7 becomes 111
  • fractional part 0.25 becomes .01
    So the full binary value is 111.01.

Next, normalise it so the binary point is after the sign bit of the mantissa. For a value of magnitude greater than 1, that means shifting the point left and increasing the exponent.

Because the number is negative, find the bit pattern for the positive normalised mantissa first, then convert that mantissa into two's complement.

Step-by-Step Reasoning

7 in binary is 111.

0.25 in binary is .01.

So:

7.25 = 111.01

Now include the sign:

-7.25 = -111.01

To normalise, shift the binary point 3 places left:

-111.01 = -0.11101 × 2^3

Now write the positive mantissa using 10 bits total. Since the binary point is after the sign bit, we need:

  • 1 sign bit
  • 9 fractional bits

+0.11101 becomes:

0111010000

This is the positive version. But the mantissa must represent a negative value, so take the two's complement:

  • invert: 1000101111
  • add 1: 1000110000

So the 10-bit mantissa is:

1000110000

Now encode the exponent. We shifted left 3 places, so the exponent is +3.

In 6-bit two's complement, +3 is simply:

000011

So the final normalised floating-point representation is:

  • mantissa 1000110000
  • exponent 000011

Key Takeaways

  • Convert the denary value to binary first.
  • Normalisation means shifting the binary point and adjusting the exponent.
  • In this syllabus, a normalised two's complement mantissa starts 01 for positive values and 10 for negative values.
  • For a negative mantissa, write the positive form first, then take its two's complement.

Common Mistakes

  • Writing the mantissa as sign-magnitude instead of two's complement.
  • Forgetting that the binary point is after the sign bit in the mantissa.
  • Using the wrong exponent because of counting the shifts incorrectly.
  • Not padding the mantissa to the full 10 bits.
  • Giving a negative mantissa that does not begin 10, so it is not normalised.

Things to Be Careful About

  • Count total mantissa bits, not just bits after the point.
  • The exponent must also be in two's complement, even when it is positive.
  • Do not store 111.01 directly in the mantissa; it must be normalised first.
  • Make sure the final mantissa is exactly 10 bits and the exponent exactly 6 bits.
Techniques used
convert a denary fraction to binarynormalise the binary value into mantissa and exponent formencode a negative mantissa using two's complement
(b)

Calculate the denary value of the given binary floating-point number.
Show your working.

MantissaExponent
1011000111000111

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

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

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

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

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

Answer ......................................................................................................................................

3M
DifficultyMedium
Worked solution

Working

Exponent:

000111 = 7

Mantissa 1011000111 is negative.

Two's complement gives:

0100111001

So mantissa = -0.100111001

Apply the exponent:

-0.100111001 × 2^7 = -1001110.01

1001110.01 = 78.25

Answer

-78.25

Final answer

-78.25

Detailed explanation

Background Concept

To convert a floating-point number back to denary, you interpret the mantissa and exponent separately, then combine them.

In this representation:

  • the mantissa is a signed binary fraction in two's complement
  • the exponent is a signed integer in two's complement
  • the actual value is:
    mantissa × 2^(exponent)

For a negative mantissa in two's complement, it is usually easiest to:

  1. recognise that the leading bit is 1, so it is negative
  2. take the two's complement to find the positive magnitude
  3. apply the minus sign

Understanding the Question

The given 16-bit floating-point number is already split into:

  • mantissa: 1011000111
  • exponent: 000111

You must calculate its denary value. That means:

  • decode the exponent as a normal 6-bit two's complement integer
  • decode the mantissa as a 10-bit two's complement fraction
  • multiply the mantissa by 2^exponent

Approach

Start with the easier field: the exponent. Because it begins with 0, it is positive.

Then decode the mantissa. Because it begins with 1, it is negative, so take the two's complement to recover the positive fractional pattern.

Finally, apply the exponent as a binary-point shift.

Step-by-Step Reasoning

Exponent first:

000111 = 7

So the number is:

mantissa × 2^7

Now decode the mantissa 1011000111.

Because the first bit is 1, the mantissa is negative.

Take its two's complement:

  • invert: 0100111000
  • add 1: 0100111001

So the positive magnitude is:

0.100111001

Therefore the mantissa is:

-0.100111001

Now apply the exponent 7:

-0.100111001 × 2^7

Shifting the binary point 7 places to the right gives:

-1001110.01

Convert 1001110.01 to denary:

  • 1001110 = 64 + 8 + 4 + 2 = 78
  • .01 = 0.25

So the value is:

-78.25

Key Takeaways

  • A floating-point value is found by decoding the mantissa and exponent separately.
  • A two's complement mantissa with leading 1 is negative.
  • Applying the exponent means shifting the binary point, not changing the bit pattern itself.
  • Converting the final binary result to denary is often the simplest last step.

Common Mistakes

  • Treating the mantissa as an unsigned fraction.
  • Forgetting to take the two's complement of the negative mantissa.
  • Misreading 000111 as something other than +7.
  • Moving the binary point the wrong direction.
  • Converting the mantissa to denary first but forgetting the negative sign at the end.

Things to Be Careful About

  • Keep mantissa and exponent separate until you have decoded both.
  • The mantissa is fractional, so the binary point is after the sign bit.
  • When taking two's complement, invert all bits and then add 1.
  • Make sure the final answer is in denary, because that is what the question asks for.
Techniques used
decode a two's complement exponentdecode a two's complement fractional mantissaapply the exponent shift to recover the denary value
(c)

The given binary floating-point number is not normalised.

Normalise the floating-point number. Show your working.

MantissaExponent
0000000111100111
MantissaExponent

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

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

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

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

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

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

3M
DifficultyMedium
Worked solution

Working

Original mantissa: 0000000111

For a positive normalised mantissa, the first two bits must be 01.

Shift mantissa left 6 places:

0000000111 → 0111000000

Original exponent 100111 = -25

After shifting left 6 places, exponent becomes -31.

-31 in 6-bit two's complement is 100001.

Answer

Mantissa: 0111000000

Exponent: 100001

Final answer

Mantissa 0111000000, Exponent 100001

Detailed explanation

Background Concept

A floating-point number is normalised when the mantissa is stored in a standard form that avoids wasted leading bits.

In two's complement floating-point used in this syllabus:

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

If a positive mantissa begins 00, it is not normalised because there are unnecessary leading zeros. You fix this by shifting the mantissa left until the first two bits become 01.

Each left shift multiplies the mantissa by 2, so to keep the overall value unchanged, the exponent must decrease by 1 for each shift.

Understanding the Question

You are given a floating-point number that is stated to be not normalised:

  • mantissa 0000000111
  • exponent 100111

You must rewrite it in normalised form without changing its value.

So the task is not to find a new number. It is to store the same number in the correct normalised layout.

Approach

Look at the mantissa first. Because it starts 00, it is a positive value but not normalised.

Shift it left until the first two bits are 01. Count how many shifts you make. Then subtract that count from the exponent.

Finally, convert the new exponent back into 6-bit two's complement.

Step-by-Step Reasoning

The original mantissa is:

0000000111

For a positive normalised mantissa, the first two bits should be 01, not 00.

Shift left one place at a time:

  • 0000001110
  • 0000011100
  • 0000111000
  • 0001110000
  • 0011100000
  • 0111000000

After 6 shifts, the first two bits are 01, so the mantissa is now normalised.

New mantissa:

0111000000

Now adjust the exponent.

Original exponent is 100111.

This is a 6-bit two's complement value. It is negative:

  • invert: 011000
  • add 1: 011001 = 25
    So the exponent is -25.

Because the mantissa was shifted left 6 places, the exponent must decrease by 6:

-25 - 6 = -31

Now convert -31 to 6-bit two's complement:

  • +31 = 011111
  • invert: 100000
  • add 1: 100001

So the new exponent is:

100001

Final normalised form:

  • mantissa 0111000000
  • exponent 100001

Key Takeaways

  • Positive normalised two's complement mantissas begin 01.
  • To normalise, shift the mantissa left until the correct leading pattern appears.
  • Every left shift of the mantissa means subtract 1 from the exponent.
  • Normalising changes the stored form, not the value represented.

Common Mistakes

  • Shifting the mantissa but forgetting to change the exponent.
  • Adding to the exponent instead of subtracting.
  • Stopping too early, for example at 0011100000, which is still not normalised.
  • Giving the new exponent in ordinary binary instead of two's complement.
  • Thinking the mantissa is negative because it will eventually start with 0 and 1; the sign is still positive because the first bit is 0.

Things to Be Careful About

  • Check the first two bits, not just whether there is a 1 somewhere in the mantissa.
  • Count the number of left shifts accurately.
  • Keep the bit lengths exact: 10 bits for mantissa, 6 bits for exponent.
  • Do not change the sign of the number while normalising.
Techniques used
identify that the mantissa is not normalisedleft shift the mantissa until the normalised pattern is reachedadjust the exponent to preserve the value
(d)

The denary number 513 cannot be stored accurately as a normalised floating-point number in this computer system.

(i)

Explain the reason for this.

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

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

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

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

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

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

3M
DifficultyMedium
Worked solution

Answer

  • 513 = 1000000001 in binary.
  • Normalised form is 0.1000000001 × 2^10.
  • This needs 10 bits after the binary point in the mantissa, but a 10-bit mantissa has only 9 bits after the sign bit.
  • Therefore the last 1 cannot be stored exactly, so the value has to be rounded and cannot be stored accurately.
Final answer

513 needs more mantissa precision than 10 bits provide

Detailed explanation

Background Concept

A floating-point number can fail to be stored accurately for two main reasons:

  • the exponent is out of range, causing overflow or underflow
  • the mantissa does not have enough bits, causing loss of precision or rounding

The mantissa controls precision. The exponent controls range.

In this system, the mantissa is 10 bits long in total. Since one of those bits is the sign bit, there are only 9 fractional bits left to store the significant part of the number.

So even if the exponent is large enough, the number may still be impossible to store exactly if it needs more significant bits than the mantissa can hold.

Understanding the Question

You are told that 513 cannot be stored accurately as a normalised floating-point number in this system.

The question asks you to explain why. So you need to identify the exact limitation:

  • is the exponent too small?
  • or is the mantissa not precise enough?

A strong answer makes it clear that the problem is precision, not range.

Approach

Convert 513 to binary, then write it in normalised form. After that, count how many bits are needed in the mantissa.

If the number of significant bits needed is greater than the number available in the mantissa, the value cannot be stored exactly.

Step-by-Step Reasoning

First convert 513 to binary.

513 = 512 + 1 = 2^9 + 1

So:

513 = 1000000001

Now write it in normalised form:

1000000001 = 0.1000000001 × 2^10

Look at the significant part 0.1000000001.

After the binary point, this needs 10 bits:

1000000001

But the mantissa field has only 10 bits in total, and one of those is used for the sign bit. That leaves only 9 bits after the sign bit.

So there is not enough room to store all the significant bits exactly. The last 1 would be lost or the value would have to be rounded.

The exponent is not the problem here, because 10 can be stored easily in a 6-bit two's complement exponent.

So the reason is insufficient mantissa precision.

Key Takeaways

  • Mantissa length determines accuracy.
  • Exponent length determines range.
  • A number can be within range but still impossible to store exactly.
  • To test this, write the number in normalised form and count the required significant bits.

Common Mistakes

  • Saying the number is too large for the exponent range. It is not.
  • Forgetting that one mantissa bit is the sign bit.
  • Writing the normalised form incorrectly, for example with the wrong exponent.
  • Saying the number cannot be stored at all. It can be stored approximately, just not accurately.

Things to Be Careful About

  • Use the word "accurately" correctly: it means exactly, without rounding error.
  • Distinguish clearly between overflow and loss of precision.
  • Count the bits after the sign bit in the mantissa, not the total floating-point bits.
  • In normalised form for a positive number, the mantissa should begin 01.
Techniques used
convert the denary integer to binaryexpress the value in normalised floating-point formcompare required precision with available mantissa bits
(ii)

Describe an alteration to the way floating-point numbers are stored to enable this number to be stored accurately using the same total number of bits.

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

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

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

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

2M
DifficultyMedium-Easy
Worked solution

Answer

  • Use more bits for the mantissa and fewer bits for the exponent, keeping 16 bits in total.
  • For example, use an 11-bit mantissa and a 5-bit exponent.
  • Then 0.1000000001 × 2^10 can be stored exactly, and exponent 10 still fits.
Final answer

Increase the mantissa to 11 bits and reduce the exponent to 5 bits

Detailed explanation

Background Concept

When a floating-point system has a fixed total number of bits, there is a trade-off:

  • more mantissa bits gives better precision
  • more exponent bits gives a wider range

If a number cannot be stored exactly because the mantissa is too short, one solution is to move bits from the exponent field to the mantissa field.

That only works if the new, shorter exponent is still large enough to store the required exponent value.

Understanding the Question

You must describe a change to the representation so that 513 can be stored accurately, but you must keep the same total number of bits.

So you are not allowed to increase the total from 16 bits. You have to rebalance the existing 16 bits between mantissa and exponent.

Approach

From part (i), the issue is that the mantissa needs one more significant bit.

So the obvious fix is:

  • increase the mantissa by 1 bit
  • reduce the exponent by 1 bit

Then check whether the exponent still has enough range to store 10.

Step-by-Step Reasoning

513 in normalised form is:

0.1000000001 × 2^10

To store 0.1000000001 exactly, the mantissa needs:

  • 1 sign bit
  • 10 bits after the binary point

So the mantissa must be 11 bits long in total.

At the moment it is only 10 bits, so add 1 bit to the mantissa.

Because the total must stay at 16 bits, take that bit from the exponent:

  • mantissa becomes 11 bits
  • exponent becomes 5 bits

Now check the exponent range. A 5-bit two's complement exponent can store from -16 to +15, so exponent +10 still fits.

Therefore this altered format can store 513 exactly.

Key Takeaways

  • Floating-point design is a balance between precision and range.
  • If precision is the problem, increase mantissa length.
  • If range is still sufficient, you can reduce exponent length.
  • Always check that the new exponent field can still hold the required exponent.

Common Mistakes

  • Suggesting more total bits, even though the question forbids that.
  • Reducing the mantissa instead of increasing it.
  • Forgetting to check whether the smaller exponent field can still store 10.
  • Saying to use an unsigned exponent or mantissa when the system is defined as two's complement.

Things to Be Careful About

  • Keep the total at 16 bits.
  • State clearly that the change is to the allocation of bits, not the value itself.
  • The best answer explains why the change works, not just what the change is.
  • A specific example such as 11-bit mantissa and 5-bit exponent is stronger than a vague answer like "use more mantissa bits."
Techniques used
reallocate bits between mantissa and exponentpreserve the total bit countmatch mantissa precision to the required significant bits

The rest of this paper

8 more questions
  • Q2Data Representation8M
  • Q3System Software9M
  • Q4System Software · Computational Thinking and Problem-solving8M
  • Q5Artificial Intelligence (AI)8M
  • Q6Communication and Internet Technologies4M
  • Q7Hardware and Virtual Machines8M
  • Q8Computational Thinking and Problem-solving8M
  • Q9Further Programming8M
Loading the full paper…