Flashcards: Programming Language Paradigms — 30 cards

All cards

1Question

What is a programming paradigm?

Answer

A fundamental style or approach for structuring computer code.

2Question

What distinguishes a programming language from a programming paradigm?

Answer

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

3Question

What is true about most modern programming languages regarding paradigms?

Answer

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

4Question

What does state mean in programming?

Answer

Data stored in memory at a specific moment during execution.

5Question

What is state mutation in programming?

Answer

Changing memory values in place over time during execution.

6Question

What are the two primary programming paradigm branches?

Answer

Imperative and declarative.

7Question

How are imperative and declarative paradigms classified?

Answer

By how they handle state and control flow.

8Question

What does the imperative paradigm specify?

Answer

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

9Question

Which sub-paradigms belong to the imperative branch?

Answer

Procedural and object-oriented programming.

10Question

What does the declarative paradigm specify?

Answer

What result is required without detailing execution steps.

11Question

Which sub-paradigms belong to the declarative branch?

Answer

Functional programming, logic programming, and database querying.

12Question

What type of state do imperative programs generally use?

Answer

Mutable state.

13Question

What type of state do declarative programs use?

Answer

Immutable state.

14Question

Which control flow constructs are common in imperative programming?

Answer

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

15Question

Which control flow methods are used in declarative programming?

Answer

Recursion, higher-order functions, and pattern matching.

16Question

How are side effects treated in imperative programming?

Answer

They are common and expected.

17Question

How does declarative programming handle side effects?

Answer

It minimizes or eliminates them.

18Question

What are the primary units used in imperative programming?

Answer

Statements, procedures, and objects.

19Question

Name some representative declarative programming languages.

Answer

Haskell, Prolog, SQL, and HTML.

20Question

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

Answer

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]?

Answer

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]?

Answer

They filter out even numbers before summing.

23Question

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

Answer

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

24Question

What benefit does functional immutability provide in multithreaded systems?

Answer

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

25Question

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

Answer

Object-oriented models are used for domain entities.

26Question

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

Answer

Functional pipelines are used for ETL data-stream processing.

27Question

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

Answer

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

28Question

What does referential transparency mean for a function?

Answer

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

29Question

Why is add(x, y) referentially transparent?

Answer

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?

Answer

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

Test yourself with the quiz

Test your knowledge with 18 questions on 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?

Take the quiz →

Read the revision sheet

Review the complete course in the revision sheet for Programming Language Paradigms.

See revision sheet →

Similar courses

Create your own flashcards

Import your course and AI generates flashcards in 30 seconds.

Flashcard generator