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
- (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]
- (b)Identify one programming technique used in the algorithm.[1]
- (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]
- (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] (a) Error 1: Line 02 - should be DECLARE DenaryNumber : INTEGER
- [1] (a) Error 2: Line 05 - should be FOR Count ← 8 TO 1 STEP -1
- [1] (a) Error 3: Line 06 - should be BinaryArray[Count] ← MOD(DenaryNumber,2)
- [1] (b) Any one from: Input, Output, Iteration
- [1] (c)(i) Range check
- [1] (c)(ii) Use of a suitable loop
- [1] (c)(ii) suitable condition (e.g., >= 1 AND <= 255)
- [1] (c)(ii) Correct input of DenaryNumber
- (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 →