A program processes sensor calibration data using the following variable assignments:
sensor_id ← 'A-9082-XT_Primary'
mode ← 'HighRes'
calibration ← 'Offset: -12.4'
The following statements are then executed:
x ← SUBSTRING(2, 4, sensor_id)
y ← POSITION(calibration, ':')
result ← x + SUBSTRING(y + 2, 5, calibration)
What is the value of result?
Note:
SUBSTRING(start, length, string) extracts a portion of a string starting at the 0-based index start with the specified length. For example, SUBSTRING(1, 3, 'computer') returns 'omp'.POSITION(string, character) returns the 0-based index of the first occurrence of character in string.+ performs string concatenation when applied to string values.′9082−12.4′'9082-12.4'′9082−12.4′
′−908−12.4′'-908-12.4'′−908−12.4′
9069.69069.69069.6
′908212.4′'908212.4'′908212.4′
89 exam-style questions on AQA GCSE Computer Science String handling operations in a programming language. Each one has a worked solution and a mark scheme showing where the marks go.