String handling operations in a programming language

EasyMedium
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
Question 42
Easy

In AQA pseudo-code, string indexing starts at 0. The function SUBSTRING(startPosition,length,string)\text{SUBSTRING}(\text{startPosition}, \text{length}, \text{string})SUBSTRING(startPosition,length,string) is used to extract a portion of a string. Which statement correctly extracts the first 5 characters from a string variable named securityKey\text{securityKey}securityKey and assigns the result to a variable named keyCode\text{keyCode}keyCode?

securityKey←SUBSTRING(0,5,keyCode)\text{securityKey} \leftarrow \text{SUBSTRING}(0, 5, \text{keyCode})securityKey←SUBSTRING(0,5,keyCode)

keyCode←SUBSTRING(1,5,securityKey)\text{keyCode} \leftarrow \text{SUBSTRING}(1, 5, \text{securityKey})keyCode←SUBSTRING(1,5,securityKey)

keyCode←SUBSTRING(0,5,securityKey)\text{keyCode} \leftarrow \text{SUBSTRING}(0, 5, \text{securityKey})keyCode←SUBSTRING(0,5,securityKey)

keyCode←SUBSTRING(securityKey,0,5)\text{keyCode} \leftarrow \text{SUBSTRING}(\text{securityKey}, 0, 5)keyCode←SUBSTRING(securityKey,0,5)

String handling operations in a programming language Questions

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