Floating-point Numbers, Representation & Manipulation (Cambridge (CIE) A Level Computer Science): Exam Questions

Exam code: 9618

36 mins7 questions
1a3 marks

Numbers are stored in a computer using binary 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.

Calculate the normalised binary floating-point representation of +201.125 in this system.

Show your working.

Mantissa

Exponent

1b3 marks

Calculate the denary value of the given normalised binary floating-point number.

Show your working.

Mantissa

1

0

1

0

1

1

0

0

1

1

Exponent

0

0

0

1

0

1

2a2 marks

Numbers are stored in a computer using binary floating‑point representation with:

  • 12 bits for the mantissa

  • 4 bits for the exponent

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

Calculate the denary value of the given normalised binary floating‑point number.

Show you working.

Mantissa

0

1

0

0

0

1

1

1

0

1

1

1

Exponent

0

1

1

1

2b4 marks

Calculate the normalised binary floating‑point representation of – 49.1875 in this system.

Show your working.

Mantissa

Exponent

32 marks

Three points on a grid form a triangle with sides of length A, B and C as shown in the example:

Graph of a triangle on a 10x10 grid with vertices labelled A, B, and C; x and y axes marked from 0 to 10.

A triangle is said to be right-angled if the following test is true (where A is the length of the longest side):

A2 = B2 + C2

A2 means A multiplied by A, for example 32 means 3 × 3 which evaluates to 9

You can calculate A2, B2 and C2 by using the coordinates of the endpoints of each line.

For example, B2 is calculated as follows:

Graph with grid showing points P1 (x1, y1) and P2 (x2, y2) connected by line B, on axes 0-10 with x and y orientation labels.

The endpoints, P1 and P2, have the coordinates (3, 2) and (6, 6).

The value B2 is given by the formula:

B2 = (x1 − x2) 2 + (y1 − y2) 2

In this example:

B2 = (3 − 6)2 + (2 − 6)2
B2 = (–3)2 + (–4)2
B2 = 9 + 16
B2 = 25

The test used to check if a triangle is right-angled can be written in two ways:

A2 = B2 + C2

or

A = √(B2 + C2)

The symbol √ represents the square root operation. For example, √81 = 9

A new function SQRT() is written to perform the square root operation. The function takes an integer number as a parameter and returns a positive real value representing the square root of the number.

During testing it is found that the SQRT() function returns a value that is only accurate to 4 decimal places.

For example, SQRT(25) returns 5.0000125 rather than the correct value of 5.0

The function IsRA() from part (a) is modified to use the new SQRT() function to test if a triangle is right-angled.

Describe a problem that might occur when using the modified IsRA() function and suggest a solution that still allows the SQRT() function to be used.

4a3 marks

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.

Calculate the denary value of the given normalised floating-point number.

Show your working.

Mantissa

0

1

0

0

1

1

1

1

0

0

Exponent

0

0

1

0

0

1

4b3 marks

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

Mantissa

Exponent

5a2 marks

Describe the effect of changing the allocation of bits used for the mantissa and for the exponent in a floating-point number with a fixed total number of bits.

5b3 marks

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.

Calculate the normalised floating-point representation of +54.8125 in this system.

Show your working.

Mantissa

Exponent

6a3 marks

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

  • 12 bits for the mantissa

  • 4 bits for the exponent

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

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

Show your working.

Mantissa

Exponent

6b2 marks

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

7a3 marks

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.

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

Show your working.

Mantissa

Exponent

7b3 marks

Explain why a binary representation is sometimes only an approximation to the real number it represents.