OOP and Functional Programming Homework 3
OOP and Functional Programming Homework 3
(b) Name four programming paradigms and for each one, give an example of a
programming language which supports it. [8]
(i)
(ii)
(iii)
(iv)
(b) Write a function definition for a second function named doubleIt which
returns the value of g(x) = 2x. [2]
(c) Combine the two functions in (a) and (b) to write a function h(x) which returns
the value of
h(x) = g(f(x))
Name the function trebleThenDouble.
What will be returned when this function is applied to the parameter 4? [2]
1
Homework 3 Functional programming
Unit 12 OOP and functional programming
[Total 25 Marks]