Cards (14)

  • What is functional programming primarily based on?
    Mathematical functions
  • In functional programming, variables and data structures are considered immutable
  • Pure functions in functional programming have side effects.
    False
  • What are higher-order functions in functional programming?
    Functions accepting other functions
  • In the example code, the `apply_operation` function is a higher-order function because it takes another function as an argument
  • First-class functions can be assigned to variables.
  • First-class functions can be passed as arguments to other functions
  • What does the expression `def create_function(): return \lambda x: x + 1` return?
    A function
  • First-class functions enhance code reusability.
  • In the example code, the `apply_operation` function uses the first-class function `add` as an argument
  • What does the `create_multiplier` function return?
    A function
  • First-class functions can be returned from other functions.
  • What is the output of the `double` function when called with the argument 5?
    10
  • The `create_multiplier` function creates a new function called multiplier