What does “composition” refer to in functional programming?

What does “composition” refer to in functional programming?

a) The use of inheritance between classes
b) Combining two or more functions to form a new function
c) Defining functions inside a loop
d) Modifying the global state

Answer:

b) Combining two or more functions to form a new function

Explanation:

Function composition in functional programming is the process of combining two or more functions to produce a new function, where the output of one function becomes the input to the next.

Reference:

Functional Programming Quiz – MCQ Questions and Answers

Scroll to Top