Suppose f is a function that returns the result of reversing the string of symbo
ID: 3784649 • Letter: S
Question
Suppose f is a function that returns the result of reversing the string of symbols given as its input, and g is a function that returns the concatenation of the two strings given as its input. If x is the string abcd, what is returned by g(f(x),x)?
- Based on the information provided in the presented problem, identify what is returned by g(f(x),x) if x is the string ‘abcd’.
Explain how you reached your answer (Include your pseudo-code) and explain the programming paradigm(s) your pseudo-code supports and why/how.
Fully state and justify any choices, assumptions or claims that you make references to any sources you have used.
Explanation / Answer
Ans. g(f(x), x) => g(f(abcd), x)
=> g(dcba,x) (Since f reverses the string)
=> dcbax (Since g concatenates the 2 strings)