Flashcards: Programming Language Paradigms — 30 cartões

Todos os cartões

1Pergunta

What is a programming paradigm?

Resposta

A fundamental style or approach for structuring computer code.

2Pergunta

What distinguishes a programming language from a programming paradigm?

Resposta

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

3Pergunta

What is true about most modern programming languages regarding paradigms?

Resposta

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

4Pergunta

What does state mean in programming?

Resposta

Data stored in memory at a specific moment during execution.

5Pergunta

What is state mutation in programming?

Resposta

Changing memory values in place over time during execution.

6Pergunta

What are the two primary programming paradigm branches?

Resposta

Imperative and declarative.

7Pergunta

How are imperative and declarative paradigms classified?

Resposta

By how they handle state and control flow.

8Pergunta

What does the imperative paradigm specify?

Resposta

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

9Pergunta

Which sub-paradigms belong to the imperative branch?

Resposta

Procedural and object-oriented programming.

10Pergunta

What does the declarative paradigm specify?

Resposta

What result is required without detailing execution steps.

11Pergunta

Which sub-paradigms belong to the declarative branch?

Resposta

Functional programming, logic programming, and database querying.

12Pergunta

What type of state do imperative programs generally use?

Resposta

Mutable state.

13Pergunta

What type of state do declarative programs use?

Resposta

Immutable state.

14Pergunta

Which control flow constructs are common in imperative programming?

Resposta

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

15Pergunta

Which control flow methods are used in declarative programming?

Resposta

Recursion, higher-order functions, and pattern matching.

16Pergunta

How are side effects treated in imperative programming?

Resposta

They are common and expected.

17Pergunta

How does declarative programming handle side effects?

Resposta

It minimizes or eliminates them.

18Pergunta

What are the primary units used in imperative programming?

Resposta

Statements, procedures, and objects.

19Pergunta

Name some representative declarative programming languages.

Resposta

Haskell, Prolog, SQL, and HTML.

20Pergunta

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

Resposta

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

21Pergunta

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

Resposta

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

22Pergunta

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

Resposta

They filter out even numbers before summing.

23Pergunta

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

Resposta

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

24Pergunta

What benefit does functional immutability provide in multithreaded systems?

Resposta

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

25Pergunta

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

Resposta

Object-oriented models are used for domain entities.

26Pergunta

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

Resposta

Functional pipelines are used for ETL data-stream processing.

27Pergunta

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

Resposta

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

28Pergunta

What does referential transparency mean for a function?

Resposta

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

29Pergunta

Why is add(x, y) referentially transparent?

Resposta

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

30Pergunta

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

Resposta

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

Teste-se com o quiz

Teste seu conhecimento com 18 perguntas sobre 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?

Faça o quiz →

Leia a ficha de revisão

Revise o curso completo na ficha de revisão para Programming Language Paradigms.

Veja a ficha de revisão →

Similar courses

Crie seus próprios flashcards

Importe seu curso e a IA gera flashcards em 30 segundos.

Gerador de flashcards