The following pseudocode algorithm is intended to find the minimum value of elements in a 0-indexed array of rocket sensor readings called thrust_readings.
01 min_thrust = 99999
02 for i = 0 to thrust_readings.length
03 if thrust_readings[i] < min_thrust
04 min_thrust = thrust_readings[i]
05 endif
06 next i
07 print(min_thrust)
The function length returns the total number of elements in the array. This algorithm contains errors that prevent it from working as intended.
Two types of errors that can occur when designing and writing programs are syntax errors and logic errors.
State what is meant by:
A syntax error
A logic error
Practise OCR GCSE Computer Science Programming fundamentals with exam-style questions for GCSE Computer Science. 100 questions, matched to the OCR GCSE Computer Science (J277) specification and written in Component 01 and Component 02 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.