The subroutine CheckAcceleration is used in a self-driving vehicle's stability control system. The variable lateral_accel represents the lateral acceleration in m/s2\text{m/s}^2m/s2 and can store values such as −2.5-2.5−2.5, 0.00.00.0, or 1.851.851.85.
SUBROUTINE CheckAcceleration(lateral_accel)
IF lateral_accel < -1.5 OR lateral_accel > 1.5 THEN
RETURN 'W'
ELSE
RETURN 'S'
ENDIF
ENDSUBROUTINE
State the most appropriate data type for each of these sets of values.
| Values | Data type |
|---|---|
| −2.5,0.0,1.85-2.5, 0.0, 1.85−2.5,0.0,1.85 | |
'W', 'S' |
Practise AQA GCSE Computer Science Data types with exam-style questions for GCSE Computer Science. 50 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 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.