What does “immutability” mean in functional programming?

What does “immutability” mean in functional programming?

a) Data cannot be changed after it is created
b) Variables can be modified freely
c) Data is mutable but can only be changed by one function
d) Only functions are immutable

Answer:

a) Data cannot be changed after it is created

Explanation:

Immutability means that once data is created, it cannot be changed. Instead of modifying data, functional programming encourages creating new data structures with the required changes.

Reference:

Functional Programming Quiz – MCQ Questions and Answers

Scroll to Top