Programming Paradigms Flashcards

(15 cards)

1
Q

What are programming paradigms?

A

Approaches to programming

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

What are the two main paradigms in programming?

A

1) Functional programming
2) Imperative programming

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

What is functional programming?

A

Programming that has no variables, and instead uses functions as mappings from one value to another

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

What is imperative programming?

A

Programming that has commands that the computer performs in a specific sequence

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

What are the two main types of imperative programming?

A

1) Procedural programming
2) Object-Oriented programming

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

What is procedural programming?

A

Type of imperative programming where programs are made up of imperative commands that are run sequentially
- Uses sequence, selection and iteration
- Broken up into smaller parts or modules using subroutines

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

What is object-oriented programming?

A

An entirely modular to programming where everything in the program is implemented as an object which has attributes and properties (data) and methods (subroutines)
- Data and code that acts on the data are kept together and controlled via methods that comprise the interface

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

What does the structural approach to programming involve?

A

1) Organise programs into subroutines and modules by using hierarchy charts to break a program down

2) Store data in variables and constants with meaningful identifiers

3) Program to the interface by using subroutines

4) Use local variables instead of global variables

5) Use indentation, spacing and comments to make code easier to follow

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

What are the advantages to the structured approach?

A
  • Subroutines and modules can be individually tested
  • Modules with related subroutines make it easy to navigate for developers
  • Indented code is easier to read
  • Comments can explain how program works to other developers
  • Meaningful identifiers make it easier to follow
  • Parameters and return values to pass values into and out of subroutines reduces likelihood for errors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a hierarchy chart?

A
  • A diagram showing the structure of a program using a top-down approach
  • Breaks system down layer-by-layer into components and processes
  • Each box contains a label / description for each process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the advantages of subroutines?

A
  • Each subroutine can be tested separately
  • Meaningful identifiers make the code easier to understand
  • Code easily reused
  • Easier to maintain as code only needs to be changed once within the subroutine
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a procedure?

A

A subroutine that does not return a value

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

What is a function?

A

A subroutine that return a value

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

How can you tell if a variable is a constant?

A

Named with all capital letters e.g. EMPTYSTRING

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

What is a local and global variable?

A
  • A local variable is declared in a subroutine or similar
  • A global variable is declared at the highest possible level in a program so that it can be used in any lower level statements
How well did you know this?
1
Not at all
2
3
4
5
Perfectly