Skip to main content
O-LevelComputer ScienceProgramming2210/23 · Oct/Nov 2024 · Q69 Marks

An incomplete algorithm has been written in pseudocode to count the number of values stored in an array and to find their average. Values have been stored in the array starting at A[1] All the values to be counted are non-zero. A value of zero in the array indicates there are no more values stored. 01 DECLARE A : ARRAY[1:50] OF INTEGER 02 DECLARE C : INTEGER 03 DECLARE W : INTEGER 04 DECLARE X : INTEGER 05 W ← 0 06 C ← 07 WHILE A[C] <> 0 08 09 C ← C + 1 10 ENDWHILE 11 X ←

  1. (a)Complete the given pseudocode algorithm.[3]
  2. (b)Write pseudocode to display, with suitable messages: • the number of values stored in the array • the average of those values stored.[3]
  3. (c)Meaningful identifiers have not been used in this algorithm. Suggest suitable meaningful identifiers for: The array A The variables C X W[3]

Mark scheme

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

  1. [3] (a) One mark for each point
  2. (a) 06 C ← 1
  3. (a) 08 W ← W + A[C]
  4. (a) 11 X ← W / (C – 1) // ROUND(W / (C – 1),0)
  5. [3] (b) One mark for outputting X
  6. (b) One mark for outputting C – 1
  7. (b) One mark for suitable messages
  8. (b) Example: 12 OUTPUT "Number of values stored in the array is ", C – 1 13 OUTPUT "Average of non-zero elements in the array is ", X
  9. [3] (c) One mark for meaningful identifier for the array
  10. (c) A Values
  11. (c) Two marks for 3 meaningful identifiers for the variables
  12. (c) or
  13. (c) One mark for 1 to 2 meaningful identifiers for the variables
  14. (c) C Index
  15. (c) X Average
  16. (c) W Total

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
Programming, O-Level Computer Science (syllabus 2210). Structured question, 9 marks.
Source
O-Level Computer Science, Oct/Nov 2024 Paper 2 Variant 3, question 6.

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