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.

Host this setFree Play

The 20 questions

  1. What defines a higher-order function in functional programming?

    • Contains nested loops
    • Takes/returns a function
    • Uses local variables
    • Executes concurrently
  2. Which higher-order function applies a function to every element in a list?

    • head
    • fold
    • map
    • filter
  3. Which higher-order function returns only list elements that satisfy a predicate?

    • fold
    • map
    • filter
    • zip
  4. Which higher-order function combines all elements of a list into one value?

    • map
    • append
    • filter
    • fold
  5. 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]
  6. What is the result of filter (> 1) applied to [1,2,3]?

    • [3]
    • [2,3]
    • [1]
    • [1,2,3]
  7. What is the result of fold (+) 0 applied to [1,2,3,4]?

    • 24
    • 10
    • 4
    • 0
  8. Which of these standard functions is classified as a higher-order function?

    • head
    • tail
    • map
    • len
  9. 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]
  10. To find the maximum value in a list using fold, which combining function is needed?

    • Maximum function
    • Equality function
    • Addition function
    • Length function
  11. Which higher-order function is best suited to square every element in a list?

    • fold
    • map
    • drop
    • filter
  12. What process creates a new function by providing fewer arguments than required?

    • Type inference
    • Pattern matching
    • Partial application
    • Function composition
  13. 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
  14. 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
  15. What happens to the relative order of elements retained by filter?

    • Order is preserved
    • List is sorted
    • Order is reversed
    • Order is randomised
  16. Why are higher-order functions like map preferred over imperative loops?

    • Enforces OOP principles
    • Uses more memory
    • Prevents recursion
    • Avoids mutable state
  17. What feature of functional programming allows functions to be passed as arguments?

    • Static typing
    • Tail recursion
    • Lazy evaluation
    • First-class functions
  18. Which higher-order function reduces a list to a single accumulated value?

    • map
    • head
    • fold
    • filter
  19. Which higher-order function applies a function to every item in a list, returning a new list?

    • zip
    • map
    • filter
    • fold
  20. What is a defining feature of a higher-order function in functional programming?

    • Takes a function
    • Runs iteratively
    • Modifies inputs directly
    • Uses global state

All AQA Computer Science quizzes