Skip to content

Course home

String handling operations in a programming language

String handling operations in a programming language

EasyMedium
1234567891011121314151617181920
Question 16

An algorithm uses the standard AQA pseudocode for string handling operations:

  • String indexing is 0-indexed.
  • LEN(string)\text{LEN}(\text{string})LEN(string) returns the number of characters in the string.
  • POSITION(string,character)\text{POSITION}(\text{string}, \text{character})POSITION(string,character) returns the 0-indexed position of the first occurrence of the character in the string.
  • SUBSTRING(start,length,string)\text{SUBSTRING}(\text{start}, \text{length}, \text{string})SUBSTRING(start,length,string) returns the substring starting at index start\text{start}start with length length\text{length}length.

The following pseudocode is executed:

course ← 'AQA_A_Level_Computer_Science_2026'
idx1 ← POSITION(course, 'C')
idx2 ← POSITION(course, 'S')
result ← SUBSTRING(idx1, idx2 - idx1, course)
final_str ← result + 'Exam'

Select the option that shows the value returned by LEN(final_str)\text{LEN}(\text{final\_str})LEN(final_str).

A

999

B

121212

C

131313

D

141414

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