Skip to main content
A-LevelComputer ScienceFurther programming9618/22 · May/June 2023 · Q58 Marks

A programmer has produced the following pseudocode to output the square root of the numbers from 1 to 10. Line numbers are for reference only. 10 DECLARE Num : REAL 11 Num ← 1.0 ... 40 REPEAT 41 CALL DisplaySqrt(Num) 42 Num ← Num + 1.0 43 UNTIL Num > 10 ... 50 PROCEDURE DisplaySqrt(BYREF ThisNum : REAL) 51 OUTPUT ThisNum 52 ThisNum ← SQRT(ThisNum) // SQRT returns the square root 53 OUTPUT " has a square root of ", ThisNum 54 ENDPROCEDURE The pseudocode is correctly converted into program code. Function SQRT() is a library function and contains no errors. The program code compiles without errors, but the program gives unexpected results. These are caused by a design error.

  1. (a)Explain why the program gives unexpected results.[3]
  2. (b)Explain why the compiler does not identify this error.[1]
  3. (c)Describe how a typical Integrated Development Environment (IDE) could be used to identify this error.[3]
  4. (d)The pseudocode is converted into program code as part of a larger program. During compilation, a complex statement generates an error. The programmer does not want to delete the complex statement but wants to change the statement so that it is ignored by the compiler. State how this may be achieved.[1]

Mark scheme

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

  1. [3] One mark per point: • parameter / Num has been passed by reference // should have been passed by value • so when the value / ThisNum is modified (in procedure DisplaySqrt()) • the new value will be used in the loop (lines 40–43) // Num will be changed to modified value
  2. [1] The rules of the language have not been broken // there are no syntax errors
  3. [3] Could use an IDE to: • Set a breakpoint to stop the program at a certain line / statement / point • Step through the program line by line / statement by statement • checking the value of 'num' / a variable using a report / watch window One mark per bullet
  4. [1] Answers include: • Change the statement into a comment • Change the statement to a string representing a literal value and assign it to a variable / output it Note: max 1 mark

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
Further programming, A-Level Computer Science (syllabus 9618). Structured question, 8 marks.
Source
A-Level Computer Science, May/June 2023 Paper 2 Variant 2, question 5.

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