Cambridge AS Level Computer Science 9618 · 1.1 Data Representation

Q6 · 9618/12/M/J/22 Q3

Worked solution from the Information representation Paper 1 Theory Fundamentals booklet, Part 1 of 3.

Q69618/12/M/J/22original Q3Structured · 9 marks
Question 3 from 9618/12/M/J/22

Worked solution

(a)

To make every bit 1, OR with 11111111 (denary 255).

Opcode: OR [1]

Operand: #255 [1]

(XOR #154 or OR #154 also score.)

(b)

XOR flips the bits where the operand has a 1. To flip all bits use 11111111.

Opcode: XOR [1]

Operand: #255 [1]

(c)

0111 = 7 and 1110 = E, so 7E [1]

(d)

Shift every bit 3 places left, dropping 011 from the left and adding 000 on the right:

11110000 [1]

(e)

127 = 01111111 and 12 = 00001100. [1]

Subtract by adding −127. Invert 01111111 to get 10000000, add 1: 10000001. [1]

Add: 00001100 + 10000001 = 10001101 [1]

KEY IDEAOR sets bits, XOR flips bits, and subtraction is adding the two's complement.
TOTAL 9 marks

Official mark scheme

Mark scheme for 9618/12/M/J/22 question 3
VIDEO
▶ Whole paper

Video solution of the whole paper · by Exam Ninja. Tap the picture to open it on YouTube.

Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.