Lesson 4.12.2.1
4.12.2.1 Writing functional programs Quiz: AQA Computer Science, Unit 12
20 questions
In partnership with Revision Ninja
Lesson 4.12.2.1, Writing functional programs: 20 multiple choice questions for the AQA Computer Science (7517), Unit 12: Fundamentals of functional programming, written with Revision Ninja.
Host it live on the board and students join with a game code on their own devices, or revise alone with Free Play. The answers are revealed in the game.
The 20 questions
-
What defines a higher-order function in functional programming?
- Contains nested loops
- Takes/returns a function
- Uses local variables
- Executes concurrently
-
Which higher-order function applies a function to every element in a list?
- head
- fold
- map
- filter
-
Which higher-order function returns only list elements that satisfy a predicate?
- fold
- map
- filter
- zip
-
Which higher-order function combines all elements of a list into one value?
- map
- append
- filter
- fold
-
What is the result of applying a function that doubles its input to every element of [1,2,3] using map?
- [3,4,5]
- [6]
- [1,2,3]
- [2,4,6]
-
What is the result of filter (> 1) applied to [1,2,3]?
- [3]
- [2,3]
- [1]
- [1,2,3]
-
What is the result of fold (+) 0 applied to [1,2,3,4]?
- 24
- 10
- 4
- 0
-
Which of these standard functions is classified as a higher-order function?
- head
- tail
- map
- len
-
Which function call returns only the even numbers from [1,2,3,4]?
- map even [1,2,3,4]
- fold even [1,2,3,4]
- filter even [1,2,3,4]
- head [1,2,3,4]
-
To find the maximum value in a list using fold, which combining function is needed?
- Maximum function
- Equality function
- Addition function
- Length function
-
Which higher-order function is best suited to square every element in a list?
- fold
- map
- drop
- filter
-
What process creates a new function by providing fewer arguments than required?
- Type inference
- Pattern matching
- Partial application
- Function composition
-
To count negative numbers in a list, which two functions should be combined?
- fold and head
- map and filter
- filter and length
- map and sum
-
How does the length of a mapped list compare to the input list?
- It is identical
- It is zero
- It is shorter
- It is doubled
-
What happens to the relative order of elements retained by filter?
- Order is preserved
- List is sorted
- Order is reversed
- Order is randomised
-
Why are higher-order functions like map preferred over imperative loops?
- Enforces OOP principles
- Uses more memory
- Prevents recursion
- Avoids mutable state
-
What feature of functional programming allows functions to be passed as arguments?
- Static typing
- Tail recursion
- Lazy evaluation
- First-class functions
-
Which higher-order function reduces a list to a single accumulated value?
- map
- head
- fold
- filter
-
Which higher-order function applies a function to every item in a list, returning a new list?
- zip
- map
- filter
- fold
-
What is a defining feature of a higher-order function in functional programming?
- Takes a function
- Runs iteratively
- Modifies inputs directly
- Uses global state
Related quizzes
- Function types and first-class objects Quiz · 4.12.1.1 · 20 questions
- Partial function application and composition of functions Quiz · 4.12.1.4 · 20 questions
- List processing Quiz · 4.12.3.1 · 20 questions
- Data types Quiz · 4.1.1.1 · 20 questions
- Entity relationship modelling Quiz · 4.10.1.1 · 20 questions
- Big Data Quiz · 4.11.1.1 · 20 questions
- Analysis Quiz · 4.13.1.1 · 20 questions
- Data structures and abstract data types Quiz · 4.2.1.1 · 20 questions
- Breadth-first and depth-first search Quiz · 4.3.1.1 · 20 questions
- Problem-solving and algorithms Quiz · 4.4.1.1 · 20 questions