AQA A Level · Computer Science 7517

Functional programming paradigm: Practice Questions

5 multiple-choice questions marked as you go, and 5 written questions with worked solutions. All on Functional programming paradigm.

10 questions22 marksFree, no account
Question 1
1 mark

Given a function \( f: A \rightarrow B \), what does the set \( B \) represent in functional programming terms?

Question 2
1 mark

Consider the function add defined as:
\( add: \text{integer} \rightarrow (\text{integer} \rightarrow \text{integer}) \)

What is the result of the partial function application add 5?

Question 3
1 mark

Why is the functional programming paradigm particularly well-suited for writing code for Big Data systems that require distributed processing?

Question 4
1 mark

In the functional programming paradigm, what is the term used to describe a function that can be passed as an argument to another function or returned as a result from a function call?

Question 5
1 mark

Which higher-order function is used to produce a single value by repeatedly applying a combining function to all elements of a list?

Question 6
2 marks

Define a first-class object within a functional programming language.

Write your answer out first, then check it against the worked solution.

Question 7
3 marks

A function is defined as \(f: \text{integer} \to \text{integer}\). If the co-domain is the set of all integers, does the function necessarily have to output every value in that set? Explain your answer.

Write your answer out first, then check it against the worked solution.

Question 8
5 marks

Given two functions \(f(x) = x + 5\) and \(g(y) = y^2\), determine the result of the functional composition \(g \circ f\) when \(x = 3\).

Write your answer out first, then check it against the worked solution.

Question 9
3 marks

In the functional programming paradigm, functions are considered first-class objects.

(a) State three properties that define a first-class object in a programming language.
(b) A function \( f \) has the type definition \( f: \mathbb{R} \to \mathbb{Z} \). Identify the domain and the co-domain for this function.

Write your answer out first, then check it against the worked solution.

Question 10
4 marks

Functional programming uses function composition to create complex logic from simple functions.

Let \( f(x) = x + 5 \) and \( g(y) = y^2 \).

(a) Write the mathematical expression for the composition \( g \circ f \).
(b) Calculate the result of \( (g \circ f)(3) \).
(c) Explain the order in which functions are applied in the composition \( g \circ f \).

Write your answer out first, then check it against the worked solution.

* The content provided by thinka is generated by AI and may not always be accurate or up-to-date. Please use it as a supplementary resource and verify with official materials.

You've seen the model answer. Now get yours marked.

This page can show you how a good answer looks. It cannot tell you what your answer was missing. thinka marks your written work against the real mark scheme in about 15 seconds.

Want more questions like these? Get a fresh set on this topic, marked as you go.

Practise More