Question 7
AQA Computer Science June 2019 Paper 2A level5 marks
On the specification
- 7.1
- 4.12 Fundamentals of functional programming
- 7.2
- 4.12 Fundamentals of functional programming
- 7.3
- 4.12 Fundamentals of functional programming
Question text
7 Figure 5 shows three commonly used mathematical functions: add, square and box pred. Figure 5 add(x,y) = x + y 2 square(x) = x pred(x) = x - 1 For example: • add(3,2) evaluates to 5 • square(2) evaluates to 4 • pred(8) evaluates to 7 The domain of the functions square and pred in Figure 5 is the set of integers ℤ and the domain of the add function is ℤ × ℤ. 7.1 What is the co-domain of the pred function? [1 mark] 7.2 What is the result of applying square ° pred to the argument 3? [1 mark] 7.3 The add function takes two arguments. Describe how the add function could be partially applied to the arguments 4 and 6. [3 marks]