Question 2

OCR Computer Science June 2023 Computational thinking, algorithms and programming (J277-02)GCSE6 marks

On the specification

(a)
2.3 Producing robust programs
(b)
2.3 Producing robust programs
Question text

2 This pseudocode algorithm totals all the numbers in the 0-indexed array scores 1 total = 0 2 for scoreCount = 1 to scores.length – 1 3 scores[scoreCount] = total + total 4 next scoreCount 5 print(total) The function length returns the number of elements in the array. The algorithm contains several errors. Two types of errors in a program are syntax and logic errors. (a) State what is meant by a syntax error and a logic error. Syntax error Logic error [2] (b) Identify two logic errors in the pseudocode algorithm. Write the refined line to correct each error. Error 1 line number Corrected line Error 2 line number Corrected line [4]