Programming Paradigms Flashcards

1
Q

What are the 6 paradigms

A

Imperative
Procedural
Object-oriented
Event-driven
Declarative
Functional

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

Define imperative programming

A

-changes the program state by executing a series of commands
-e.g. using varibales to store and iterations

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

Define procedural programming

A

-related to imperative programming
-organises code into functions which has a sequemce of instructions
-the program is divided into smaller functions that return values

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

Define object-oriented programming

A

-subordinate of imperative programming
-creates resuable methods and classes
-code is more maintainable

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

What are the 4 principles of object-oriented programming

A

Encapsulation - binds data and keeps it protected by making the data private within their methods
Inheritance - allows child classes to take charactersitics from a parent class
Abstraction - hides complexity and only shows relevant info
Polymorphism - the same code structure can be used in different forms

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

Define functional programming

A

-building software with pure functions
-output is returned based on input given with no reliance outside of the function
-

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

Give an example of functional programming

A

using the square function as there is always the same output for the same input (always a squared number)

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

Define event driven programming

A

-programs that respond to events or user interactions
-involves real time response
-start - initialise - wait for event

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

Define declarative programming

A

-programmer specifies result and program solves how to achieve it
-e.g HTML/CSS

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