Skip to main content
A-LevelComputer ScienceAlgorithm design and problem-solving9618/22 · May/June 2025 · Q38 Marks

An algorithm is designed to generate and output two unique random integers. Each integer value is between -10 and 10 inclusive. If both integers output are negative, a third random integer between 30 and 35 inclusive will be generated and output. Write pseudocode for this algorithm.

  1. Write pseudocode for this algorithm.[8]

Mark scheme

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

  1. [8] Example solution DECLARE FirstNumber : INTEGER DECLARE SecondNumber : INTEGER DECLARE ThirdNumber : INTEGER FirstNumber ← INT(RAND(21)) - 10 OUTPUT FirstNumber REPEAT SecondNumber ← INT(RAND(21)) - 10 UNTIL FirstNumber <> SecondNumber OUTPUT SecondNumber IF FirstNumber < 0 AND SecondNumber < 0 THEN ThirdNumber ← INT(RAND(6)) + 30 OUTPUT ThirdNumber ENDIF Mark points: 1. Declare all variables used 2. Use RAND() function with any integer parameter 3. Use INT() function with any numeric parameter 4. Conditional loop until two different random numbers are generated 5. Use INT () function using random number generated between –10 and 10 inclusive in a loop 6. Output two different random integers / numbers 7. Check if both random integers / numbers are negative 8. then output a (third) random integer / number between 30 and 35 inclusive

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
Algorithm design and problem-solving, A-Level Computer Science (syllabus 9618). Structured question, 8 marks.
Source
A-Level Computer Science, May/June 2025 Paper 2 Variant 2, question 3.

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