Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which programming paradigm emphasizes immutability and avoids changing state ?

  • A.Object-oriented programming
  • B.Procedural programming
  • C.Functional programming
  • D.Logic programming

Answer: C

The paradigm is functional programming.

Functional programming builds programs from pure functions, whose output depends only on their inputs and which have no side effects. Data is immutable: instead of changing a value, a function returns a new one. Haskell, Clojure and Erlang follow this style, which makes code easier to reason about and to run in parallel.

Object-oriented programming models objects whose state changes through methods, and procedural programming works by updating variables step by step. Logic programming, as in Prolog, states facts and rules, and its defining idea is inference, not immutability.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.