Functional

What is the primary benefit of using functional programming?

What is the primary benefit of using functional programming? a) It increases the complexity of the code b) It encourages immutability, making code easier to reason about and test c) It encourages side effects d) It allows frequent modification of global variables Answer: b) It encourages immutability, making code easier to reason about and test

What is the primary benefit of using functional programming? Read More »

In functional programming, what does “partial application” mean?

In functional programming, what does “partial application” mean? a) Applying a function to all arguments at once b) Applying a function to some arguments and returning a new function for the remaining arguments c) Applying a function conditionally d) Using mutable state in functions Answer: b) Applying a function to some arguments and returning a

In functional programming, what does “partial application” mean? Read More »

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

What does “composition” refer to in functional programming? Read More »

Which of the following is a feature of functional programming?

Which of the following is a feature of functional programming? a) Mutable state b) Inheritance c) First-class functions d) Imperative loops Answer: c) First-class functions Explanation: First-class functions are a key feature of functional programming, meaning functions can be treated like any other value and passed around as arguments or returned from other functions. Reference:

Which of the following is a feature of functional programming? Read More »

What is “lazy evaluation” in functional programming?

What is “lazy evaluation” in functional programming? a) A function that runs slower than expected b) An evaluation strategy where expressions are evaluated only when their value is needed c) A method of memorizing function calls d) A technique to create recursive loops Answer: b) An evaluation strategy where expressions are evaluated only when their

What is “lazy evaluation” in functional programming? Read More »

In functional programming, which statement is true about loops?

In functional programming, which statement is true about loops? a) Loops are commonly used b) Loops are replaced with recursion or higher-order functions like map or reduce c) Loops modify global state d) Loops are used to introduce side effects Answer: b) Loops are replaced with recursion or higher-order functions like map or reduce Explanation:

In functional programming, which statement is true about loops? Read More »

What is “currying” in functional programming?

What is “currying” in functional programming? a) Transforming a function so that it takes multiple arguments into a sequence of functions, taking one argument b) A technique to modify a function’s behavior c) The process of memoization d) Recursion on multiple arguments Answer: a) Transforming a function so that it takes multiple arguments into a

What is “currying” in functional programming? Read More »

Which of the following is discouraged in functional programming?

Which of the following is discouraged in functional programming? a) Immutable data b) Side effects c) Higher-order functions d) Pure functions Answer: b) Side effects Explanation: Side effects, such as modifying global variables or performing I/O operations, are discouraged in functional programming because they can make the behavior of programs less predictable. Reference: Functional Programming

Which of the following is discouraged in functional programming? Read More »

What is “referential transparency” in functional programming?

What is “referential transparency” in functional programming? a) The ability to reference global variables b) When a function consistently yields the same result given the same inputs c) A property of functions that return nothing d) The use of object-oriented features in functions Answer: b) When a function consistently yields the same result given the

What is “referential transparency” in functional programming? Read More »

Which of the following is a common functional programming language?

Which of the following is a common functional programming language? a) Python b) Java c) Haskell d) HTML Answer: c) Haskell Explanation: Haskell is a purely functional programming language known for its strong support for immutability and higher-order functions. Reference: Functional Programming Quiz – MCQ Questions and Answers

Which of the following is a common functional programming language? Read More »

Which of the following is a key feature of functional programming?

Which of the following is a key feature of functional programming? a) Object inheritance b) Mutable state c) Higher-order functions d) Imperative loops Answer: c) Higher-order functions Explanation: Higher-order functions are functions that take other functions as arguments or return them as results, which is a fundamental feature of functional programming. Reference: Functional Programming Quiz

Which of the following is a key feature of functional programming? Read More »

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

What does “immutability” mean in functional programming? Read More »

Scroll to Top