Skip to content

OCR A-Level Computer Science: Data Representation

6 exam-style questions with full mark schemes and model answers. Write your own answer and the AI examiner marks it against the mark scheme.

Question 112 marksConvert

A processor uses 8-bit registers. Answer each part, showing your working.

(a) The unsigned denary value 182182182 is to be stored.

  • (i) Convert 182182182 to 8-bit unsigned binary. [1]
  • (ii) Convert your answer to (i) to hexadecimal. [1]
  • (iii) Convert the hexadecimal value 5A back to denary. [1]

(b) The register now holds signed integers in 8-bit two's complement.

  • (i) Represent 53-5353 in 8-bit two's complement. [1]
  • (ii) The processor evaluates (70)65(-70) - 65(70)65 by two's-complement addition (it adds the two's complement of the subtrahend). Carry out the addition, give the 8-bit pattern that is stored, and state with a reason whether overflow has occurred. [3]

(c) Real numbers are stored in a floating-point format consisting of an 8-bit two's-complement mantissa (1 sign bit, with the binary point immediately after the sign bit) followed by a 4-bit two's-complement exponent. A value is stored as mantissa 10101000 and exponent 0011. Convert this stored number to denary, showing the exponent value, the mantissa value and the final result. [5]

AI examiner · marked against the mark scheme
Question 29 marksRepresent

A system stores real numbers in the same floating-point format as the previous question: an 8-bit two's-complement mantissa (1 sign bit, with the binary point immediately after the sign bit) followed by a 4-bit two's-complement exponent.

(a) Represent the denary value +6.75+6.75+6.75 in this format. Your mantissa must be normalised. Show all your working, including the conversion to fixed-point binary and the normalisation step, and state the final mantissa and exponent. [5]

(b) A designer is considering whether to widen the exponent field by two bits and narrow the mantissa field by the same two bits, keeping the total word length unchanged. Explain the effect this re-allocation would have on the numbers the format can store, referring to the precision versus range trade-off. [4]

AI examiner · marked against the mark scheme
Question 36 marksCalculate

The following data was written for this exercise.

An uncompressed bitmap image has the following properties.

PropertyValue
Width2048 pixels
Height1536 pixels
Colour depth24 bits per pixel

(a) Calculate the size of the uncompressed image, giving your answer in mebibytes (MiB). Show your working in clear steps (pixels, then bits, then bytes, then MiB). [4]

(b) State how many distinct colours a colour depth of 24 bits per pixel can represent, and explain briefly why. [2]

AI examiner · marked against the mark scheme
Question 45 marksCalculate

The following data was written for this exercise.

A single scan line of a two-colour (1 bit per pixel) bitmap is shown below, where 0 is white and 1 is black. The line is exactly 40 pixels long.

0000000000001111000000000000111111111111

The line is to be compressed using run-length encoding (RLE). Each run is stored as a fixed-size pair: a 1-bit colour followed by a 4-bit run length.

(a) Show the run-length encoding of this line as a sequence of (colour, length) pairs. [2]

(b) Calculate the compression ratio (original size : compressed size) and state how many bits are saved. [2]

(c) State whether RLE is lossy or lossless, and give one consequence of this property. [1]

AI examiner · marked against the mark scheme
Question 54 marksApply

The following data was written for this exercise.

A message is encrypted with a Vernam cipher (a one-time pad). The 8-bit plaintext and the 8-bit key are:

Bits
Plaintext10110100
Key01101101

(a) The ciphertext is formed by combining the plaintext and key with the XOR operation, bit by bit. Calculate the 8-bit ciphertext, showing the XOR. [2]

(b) Show how the receiver recovers the original plaintext from the ciphertext, and state the one property of the key that makes a Vernam cipher theoretically unbreakable (perfectly secure). [2]

AI examiner · marked against the mark scheme
Question 63 marksCalculate

The following data was written for this exercise.

A serial link transmits 7 bits of data together with one even parity bit (the parity bit is chosen so that the total number of 1s in the 8-bit unit is even). The parity bit is sent as the least significant bit.

(a) The 7 data bits are 1011011. State the value of the even parity bit and give the full 8-bit unit that is transmitted. [1]

(b) A receiver gets the 8-bit unit 11001000. State, with a reason, whether a transmission error has been detected. [1]

(c) State one limitation of using a single parity bit for error detection. [1]

AI examiner · marked against the mark scheme