2. A string-handling function has been developed. The pseudocode for this function is shown below.
For the built-in functions list, refer to the Appendix on page 18.
(a) Complete the trace table below by performing a dry run of the function when it is called as follows:
SSM("RETRACE", "RAC")
n
f
x
y
MID(String1, x, 1)
MID(String2, y, 1)
0
0
[6]
(b) (i) Describe the purpose of function SSM.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
(ii) One of the possible return values from function SSM has a special meaning.
State the value and its meaning.
Value .................................................................................................................................
Meaning ............................................................................................................................
[2]
(iii) There is a problem with the logic of the pseudocode. This could generate a run-time error.
Describe the problem.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
xx