What is a programming paradigm?
A fundamental style or approach for structuring computer code.
What distinguishes a programming language from a programming paradigm?
A language is a tool, while a paradigm is the guiding philosophy.
What is true about most modern programming languages regarding paradigms?
They support multiple paradigms like object-oriented, functional, and procedural.
What does state mean in programming?
Data stored in memory at a specific moment during execution.
What is state mutation in programming?
Changing memory values in place over time during execution.
What are the two primary programming paradigm branches?
Imperative and declarative.
How are imperative and declarative paradigms classified?
By how they handle state and control flow.
What does the imperative paradigm specify?
How to compute a solution step by step by manipulating program state.
Which sub-paradigms belong to the imperative branch?
Procedural and object-oriented programming.
What does the declarative paradigm specify?
What result is required without detailing execution steps.
Which sub-paradigms belong to the declarative branch?
Functional programming, logic programming, and database querying.
What type of state do imperative programs generally use?
Mutable state.
What type of state do declarative programs use?
Immutable state.
Which control flow constructs are common in imperative programming?
For and while loops, explicit if branching, and jumps.
Which control flow methods are used in declarative programming?
Recursion, higher-order functions, and pattern matching.
How are side effects treated in imperative programming?
They are common and expected.
How does declarative programming handle side effects?
It minimizes or eliminates them.
What are the primary units used in imperative programming?
Statements, procedures, and objects.
Name some representative declarative programming languages.
Haskell, Prolog, SQL, and HTML.
How does the imperative C solution process the array [1, 2, 3, 4, 5]?
It initializes a mutable total, loops explicitly, tests elements conditionally, adds odd numbers, and returns total.
How does the declarative Haskell solution compute the sum of odd numbers in [1, 2, 3, 4, 5]?
It uses sum of filtered odd numbers without mutable loops or variables.
What do both imperative and declarative implementations do with even numbers in [1, 2, 3, 4, 5]?
They filter out even numbers before summing.
How does matching a programming paradigm to its domain affect bug density?
It reduces bug density by aligning the paradigm with system requirements.
What benefit does functional immutability provide in multithreaded systems?
It prevents race conditions by avoiding in-place state changes.
Which programming model is used for domain entities in modern enterprise architectures?
Object-oriented models are used for domain entities.
What approach is used for ETL data-stream processing in modern enterprise architectures?
Functional pipelines are used for ETL data-stream processing.
Which declarative markup languages are used for user interfaces and setup configurations?
HTML and YAML are used for user interfaces and setup configurations.
What does referential transparency mean for a function?
It can be replaced by its result without changing program behavior.
Why is add(x, y) referentially transparent?
It returns the same result for the same inputs and has no side effects.
What makes add_with_log(x, y) not referentially transparent?
It produces console output as an I/O side effect.
Teste tes connaissances avec un QCM de 18 questions sur Programming Language Paradigms.
1. Which statement best defines a programming paradigm in terms of code structure?
2. What distinguishes a programming language from a programming paradigm?
Révisez le cours complet dans la fiche de révision de Programming Language Paradigms.
Voir la fiche →Importe ton cours et l'IA génère des flashcards en 30 secondes.
Générateur de flashcards