You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson consolidates all the functional programming concepts covered in this course through exam-style questions, model answers, and revision strategies.
Explain the difference between imperative programming and functional programming. Give one advantage of each paradigm. [6 marks]
Imperative programming describes computation as a sequence of statements that change program state. Variables are mutable and can be reassigned. Control flow uses loops (for, while) and conditionals. Programs describe how to compute a result step by step.
Functional programming describes computation as the evaluation of mathematical functions. Data is immutable and cannot be changed once created. Control flow uses recursion and function composition. Programs describe what to compute rather than how.
Advantage of imperative: More intuitive for problems involving sequential operations and state changes, such as controlling hardware or managing user interfaces.
Advantage of functional: Easier to reason about, test, and parallelise because pure functions have no side effects and data is immutable.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.