The following pseudocode algorithm is intended to calculate the average value of elements in a 0-indexed array called temperatures.
01 sum = 0
02 for i = 0 to temperatures.length
03 sum = sum + temperatures[i] / temperatures.length
04 next i
05 print(sum)
The function length returns the number of elements in the array. This algorithm contains errors that prevent it from working correctly.
Two types of errors that can occur in programming are syntax errors and logic errors.
State what is meant by:
A syntax error
A logic error
95 exam-style questions on OCR GCSE Computer Science Programming fundamentals. Each one has a worked solution and a mark scheme showing where the marks go.