String handling operations in a programming language

EasyMedium
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
Question 33
Easy

An algorithm is shown in the pseudocode below.

1  spacecraft ← ['Voyager', 'Cassini', 'Apollo']
2  craft1 ← 'Pioneer'
3  craft2 ← 'Perseverance'
4  OUTPUT craft1
5  OUTPUT LEN(spacecraft)
6  result ← SUBSTRING(3, 8, craft2)
7  OUTPUT result

SUBSTRING returns a portion of a string containing the characters from the start index to the end index inclusive (using 0-based indexing). For example, SUBSTRING(1, 3, 'Python') will return the string 'yth'.

State the output of line 7 from this algorithm.

[1]

String handling operations in a programming language Questions

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