Flashcards : Programming Language Paradigms — 30 cartes

Toutes les cartes

1Question

What is a programming paradigm?

Réponse

A fundamental style or approach for structuring computer code.

2Question

What distinguishes a programming language from a programming paradigm?

Réponse

A language is a tool, while a paradigm is the guiding philosophy.

3Question

What is true about most modern programming languages regarding paradigms?

Réponse

They support multiple paradigms like object-oriented, functional, and procedural.

4Question

What does state mean in programming?

Réponse

Data stored in memory at a specific moment during execution.

5Question

What is state mutation in programming?

Réponse

Changing memory values in place over time during execution.

6Question

What are the two primary programming paradigm branches?

Réponse

Imperative and declarative.

7Question

How are imperative and declarative paradigms classified?

Réponse

By how they handle state and control flow.

8Question

What does the imperative paradigm specify?

Réponse

How to compute a solution step by step by manipulating program state.

9Question

Which sub-paradigms belong to the imperative branch?

Réponse

Procedural and object-oriented programming.

10Question

What does the declarative paradigm specify?

Réponse

What result is required without detailing execution steps.

11Question

Which sub-paradigms belong to the declarative branch?

Réponse

Functional programming, logic programming, and database querying.

12Question

What type of state do imperative programs generally use?

Réponse

Mutable state.

13Question

What type of state do declarative programs use?

Réponse

Immutable state.

14Question

Which control flow constructs are common in imperative programming?

Réponse

For and while loops, explicit if branching, and jumps.

15Question

Which control flow methods are used in declarative programming?

Réponse

Recursion, higher-order functions, and pattern matching.

16Question

How are side effects treated in imperative programming?

Réponse

They are common and expected.

17Question

How does declarative programming handle side effects?

Réponse

It minimizes or eliminates them.

18Question

What are the primary units used in imperative programming?

Réponse

Statements, procedures, and objects.

19Question

Name some representative declarative programming languages.

Réponse

Haskell, Prolog, SQL, and HTML.

20Question

How does the imperative C solution process the array [1, 2, 3, 4, 5]?

Réponse

It initializes a mutable total, loops explicitly, tests elements conditionally, adds odd numbers, and returns total.

21Question

How does the declarative Haskell solution compute the sum of odd numbers in [1, 2, 3, 4, 5]?

Réponse

It uses sum of filtered odd numbers without mutable loops or variables.

22Question

What do both imperative and declarative implementations do with even numbers in [1, 2, 3, 4, 5]?

Réponse

They filter out even numbers before summing.

23Question

How does matching a programming paradigm to its domain affect bug density?

Réponse

It reduces bug density by aligning the paradigm with system requirements.

24Question

What benefit does functional immutability provide in multithreaded systems?

Réponse

It prevents race conditions by avoiding in-place state changes.

25Question

Which programming model is used for domain entities in modern enterprise architectures?

Réponse

Object-oriented models are used for domain entities.

26Question

What approach is used for ETL data-stream processing in modern enterprise architectures?

Réponse

Functional pipelines are used for ETL data-stream processing.

27Question

Which declarative markup languages are used for user interfaces and setup configurations?

Réponse

HTML and YAML are used for user interfaces and setup configurations.

28Question

What does referential transparency mean for a function?

Réponse

It can be replaced by its result without changing program behavior.

29Question

Why is add(x, y) referentially transparent?

Réponse

It returns the same result for the same inputs and has no side effects.

30Question

What makes add_with_log(x, y) not referentially transparent?

Réponse

It produces console output as an I/O side effect.

Teste-toi avec le QCM

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?

Faire le QCM →

Consultez la fiche

Révisez le cours complet dans la fiche de révision de Programming Language Paradigms.

Voir la fiche →

Cours similaires

Crée tes propres flashcards

Importe ton cours et l'IA génère des flashcards en 30 secondes.

Générateur de flashcards