String handling operations in a programming language

EasyMedium
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
Question 14
Easy

State the output of line 7 from the algorithm shown in Figure 1.

(Note: Assume string indexing begins at 0 and the substring function takes parameters in the format SUBSTRING(start_index, length, string)).

Figure 1

1  towns ← ['Belfast', 'Cardiff']
2  town1 ← 'Manchester'
3  town2 ← 'Bristol'
4  OUTPUT town1
5  OUTPUT LEN(towns)
6  part ← SUBSTRING(3, 4, town1)
7  OUTPUT part
[2]

String handling operations in a programming language Questions

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