Procedural Abstraction and Functions Flashcards

1
Q

abstraction

A

in comp science: means identifying + naming something complex and then usin that name to refer to the complex thing

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

data abstraction

A

eg. design a data structure to hold details about a bank account, call it bank_account

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

procedural abstraction

A

eg. give name to piece of code that does something, use name to get that something done

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

why use functions

A
  • short name, less details on main
  • easy to edit details as you have single point of editing
  • single point of error-checking + debugging
  • reusability
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

procedural abstraction process

A
  • give name to an algorithm
  • use name to execute algorithm within another one

eg. sqrt(x) algorithm for computing sq root
sqrt(789.54)
apply aqrt procedure to 789.54

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

procedural abstraction in C++

A

called functions in C++

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

function

A

encapsulates + names an algorithm to solve a particular problem

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

some built in functions

A
pow(i,n) (cmath)
sqrt(x)
fabs(x)
sin(x)
cos(x)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

role of functions

A
  • hide detail
  • increase readability
  • allow reuse of code
  • modular software development
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

readability example

A

is_a_factor(n,d) more meaningful than

n%d == 0

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