#7 – Language Paradigms Flashcards

(11 cards)

1
Q

What is a programming paradigm?

A

A programming paradigm is a style or way of programming, such as procedural, object-oriented, or functional.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is procedural programming?

A

Procedural programming is based on sequences of instructions and function calls. It focuses on steps to achieve a task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is object-oriented programming (OOP)?

A

OOP organizes code using classes and objects. It focuses on encapsulation, inheritance, and polymorphism.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is functional programming?

A

Functional programming treats computation as the evaluation of mathematical functions. It avoids state and mutable data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Does Python support multiple paradigms?

A

Yes, Python supports procedural, object-oriented, and functional programming styles.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How is functional programming used in Python?

A

With functions like map(), filter(), reduce(), and the use of lambda expressions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a pure function?

A

A pure function always returns the same output for the same input and has no side effects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a first-class function in Python?

A

A function that can be assigned to a variable, passed as an argument, or returned from another function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the benefit of multiple paradigms in Python?

A

It allows programmers to choose the best approach for each problem, combining different styles as needed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What Python features enable OOP?

A

class, self, inheritance, methods, dunder methods like \_\_init\_\_, \_\_str\_\_, and super().

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What Python features enable functional programming?

A

lambda, map, filter, reduce, any, all, list comprehensions, and generator expressions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly