In functional programming, what is a “side effect”?

In functional programming, what is a “side effect”?

a) A function that returns a value
b) A change in the system’s state or interaction with the outside world during function execution
c) A function with no return value
d) A function that never terminates

Answer:

b) A change in the system’s state or interaction with the outside world during function execution

Explanation:

A side effect occurs when a function modifies some state or interacts with the outside world, such as updating a global variable or performing I/O, which is discouraged in functional programming.

Reference:

Functional Programming Quiz – MCQ Questions and Answers

Scroll to Top