9618/12/M/J/22 question 3: worked solution (May/June 2022, paper 12)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 1.1 Data Representation Worked solution from the Information representation Paper 1 Theory Fundamentals booklet, Part 1 of 3. Q6 9618/12/M/J/22 original Q3 Structured · 9 marks 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 IDEA OR sets bits, XOR flips bits, and subtraction is adding the two's complement. TOTAL 9 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Exam Ninja. Tap the picture to open it on YouTube.