Flashcard: Programming Language Paradigms — 30 carte

Tutte le carte

1Domanda

What is a programming paradigm?

Risposta

A fundamental style or approach for structuring computer code.

2Domanda

What distinguishes a programming language from a programming paradigm?

Risposta

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

3Domanda

What is true about most modern programming languages regarding paradigms?

Risposta

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

4Domanda

What does state mean in programming?

Risposta

Data stored in memory at a specific moment during execution.

5Domanda

What is state mutation in programming?

Risposta

Changing memory values in place over time during execution.

6Domanda

What are the two primary programming paradigm branches?

Risposta

Imperative and declarative.

7Domanda

How are imperative and declarative paradigms classified?

Risposta

By how they handle state and control flow.

8Domanda

What does the imperative paradigm specify?

Risposta

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

9Domanda

Which sub-paradigms belong to the imperative branch?

Risposta

Procedural and object-oriented programming.

10Domanda

What does the declarative paradigm specify?

Risposta

What result is required without detailing execution steps.

11Domanda

Which sub-paradigms belong to the declarative branch?

Risposta

Functional programming, logic programming, and database querying.

12Domanda

What type of state do imperative programs generally use?

Risposta

Mutable state.

13Domanda

What type of state do declarative programs use?

Risposta

Immutable state.

14Domanda

Which control flow constructs are common in imperative programming?

Risposta

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

15Domanda

Which control flow methods are used in declarative programming?

Risposta

Recursion, higher-order functions, and pattern matching.

16Domanda

How are side effects treated in imperative programming?

Risposta

They are common and expected.

17Domanda

How does declarative programming handle side effects?

Risposta

It minimizes or eliminates them.

18Domanda

What are the primary units used in imperative programming?

Risposta

Statements, procedures, and objects.

19Domanda

Name some representative declarative programming languages.

Risposta

Haskell, Prolog, SQL, and HTML.

20Domanda

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

Risposta

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

21Domanda

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

Risposta

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

22Domanda

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

Risposta

They filter out even numbers before summing.

23Domanda

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

Risposta

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

24Domanda

What benefit does functional immutability provide in multithreaded systems?

Risposta

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

25Domanda

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

Risposta

Object-oriented models are used for domain entities.

26Domanda

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

Risposta

Functional pipelines are used for ETL data-stream processing.

27Domanda

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

Risposta

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

28Domanda

What does referential transparency mean for a function?

Risposta

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

29Domanda

Why is add(x, y) referentially transparent?

Risposta

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

30Domanda

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

Risposta

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

Metti alla prova te stesso con il quiz

Metti alla prova le tue conoscenze con 18 domande su 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?

Fai il quiz →

Leggi la scheda di revisione

Ripassa il corso completo nella scheda di revisione per Programming Language Paradigms.

Vedi la scheda di revisione →

Similar courses

Crea le tue flashcard

Importa il tuo corso e l'AI genera flashcard in 30 secondi.

Generatore di flashcard