Skip to main content
O-LevelComputer ScienceData Representation2210/23 · Oct/Nov 2025 · Q78 Marks

An algorithm has been written in pseudocode to: • input a whole number between 1 and 255 inclusive • convert the input to an 8-bit binary number • store each bit of the binary number in an array. For example, if the denary number 127 was input, the binary number 01111111 would be stored in the array. 01 DECLARE BinaryArray : ARRAY[1:8] OF INTEGER 02 DECLARE DenaryNumber : CHAR 03 OUTPUT "Please enter a whole number between 1 and 255 inclusive " 04 INPUT DenaryNumber 05 FOR Count ← 7 TO 1 STEP -1 06 BinaryArray[Count] ← MOD(DenaryNumber,3) 07 DenaryNumber ← DIV(DenaryNumber,2) 08 NEXT Count

  1. (a)Identify the line numbers of the three errors in the pseudocode and suggest a correction for each error. Error 1 line number Correction Error 2 line number Correction Error 3 line number Correction[3]
  2. (b)Identify one programming technique used in the algorithm.[1]
  3. (c)(i)The algorithm can accept a number between 1 and 255 inclusive as input. Two validation checks that could be applied to DenaryNumber are a presence check and a type check. Identify one other validation check that could be applied to DenaryNumber[1]
  4. (c)(ii)Write the pseudocode to implement the validation check you identified in (c)(i). You do not need to rewrite the whole algorithm.[3]

Mark scheme

Marking points from the official mark scheme (Oct/Nov 2025). The mark or mark type is shown in brackets.

  1. [1] (a) Error 1: Line 02 - should be DECLARE DenaryNumber : INTEGER
  2. [1] (a) Error 2: Line 05 - should be FOR Count ← 8 TO 1 STEP -1
  3. [1] (a) Error 3: Line 06 - should be BinaryArray[Count] ← MOD(DenaryNumber,2)
  4. [1] (b) Any one from: Input, Output, Iteration
  5. [1] (c)(i) Range check
  6. [1] (c)(ii) Use of a suitable loop
  7. [1] (c)(ii) suitable condition (e.g., >= 1 AND <= 255)
  8. [1] (c)(ii) Correct input of DenaryNumber
  9. (c)(ii) Example: REPEAT; INPUT DenaryNumber; UNTIL DenaryNumber >= 1 AND DenaryNumber <= 255

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Data Representation, O-Level Computer Science (syllabus 2210). Structured question, 8 marks.
Source
O-Level Computer Science, Oct/Nov 2025 Paper 2 Variant 3, question 7.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep