Save
...
12.0 Fundamentals of functional programming
12.2 Programming with functions
12.2.2 Map, filter, and reduce
Save
Share
Learn
Content
Leaderboard
Share
Learn
Cards (56)
Functional programming treats computation as the evaluation of mathematical
functions
Functional programming relies on state modification during computation.
False
Match the key principle of functional programming with its description:
Immutability ↔️ Data cannot be modified after creation
Statelessness ↔️ Functions do not rely on external state
Pure Functions ↔️ Return same output for same input
The Map Function transforms a list by applying a function to each
element
The Map Function modifies the original list when transforming its elements.
False
The Filter Function selects elements from a list that meet criteria specified by a
predicate
The Filter Function modifies the original list when selecting elements.
False
The Reduce Function combines elements of a list into a single
value
The Reduce Function modifies the original list when combining elements.
False
The Map Function applies a given function to each
element
What does the Reduce Function combine elements into?
A single value
The Reduce Function uses an
accumulator
to combine list elements.
The Reduce Function modifies the original list.
False
What does the example in Python calculate using the Reduce Function?
The sum of numbers
The Map Function returns a new
list
with transformed elements.
The Map Function changes the original list.
False
What does the Python example in the Map Function calculate?
The square of numbers
The `map()` function in Python uses a
lambda
function for transformation.
What is the primary emphasis of Functional Programming?
Mathematical functions
Functional Programming allows state modification.
False
Match the aspect with the correct programming paradigm:
Paradigm ↔️ Functional Programming
State ↔️ No state modification
Mutability ↔️ Data is immutable
Functions ↔️ Pure functions with no side effects
What are the key principles of Functional Programming?
Immutability, statelessness, pure functions
The Map Function returns a new list with
transformed
results.
Is the Map Function destructive?
No
The Filter Function modifies the original list.
False
The Filter Function uses a
predicate
function to select elements.
What does the Python example in the Filter Function select?
Even numbers
The Reduce Function modifies the original list.
False
What type of value does the Reduce Function return?
A single aggregated value
The Map Function applies a function to each
element
of a list.
Is the Map Function destructive?
No
The Map Function transforms each element of a list without modifying the
original
list.
Match the functional programming concept with its description:
Reduce Function ↔️ Combines elements into a single value
Map Function ↔️ Transforms each element of a list
Filter Function ↔️ Selects elements based on a predicate
What does the Map Function apply to each element of a list?
A given function
The Map Function is non-destructive, meaning it leaves the original list
unchanged
The original list is modified by the Map Function.
False
What is the purpose of the Filter Function?
Selecting elements
The Filter Function creates a new list based on a specified
predicate
function.
The Filter Function alters the original list.
False
What does the Reduce Function use to combine list elements?
An accumulator
See all 56 cards