Skip to content

Course home

String handling operations in a programming language

String handling operations in a programming language

EasyMedium
1234567891011121314151617181920
Question 4

An embedded system monitoring a satellite payload uses the following variables to store status data:

satellite_id ← 'Astro-X9_Telemetry'
sensor_type ← 'Infrared_Payload'
orbit_class ← 'Low_Earth_Orbit'
status_code ← 'Error:0x4F_Degraded'

The system uses two standard string handling functions:

  • POSITION(string, character) returns the 0-based index of the first occurrence of character in string.
  • SUBSTRING(start, length, string) returns the substring of length length starting at the 0-based position start.

The variable y is assigned a value using the following statement:

y ← SUBSTRING(POSITION(status_code, '0'), 6, status_code)

What is the value of y?

A

’0x4F_’\texttt{'0x4F\_'}’0x4F_’

B

’x4F_De’\texttt{'x4F\_De'}’x4F_De’

C

’0x4F_D’\texttt{'0x4F\_D'}’0x4F_D’

D

’or:0x4’\texttt{'or:0x4'}’or:0x4’

Markscheme

String handling operations in a programming language Questions

  1. GCSE
  2. /Computer Science
  3. /String handling operations in a programming language

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.

Question bank