thinking ahead Flashcards

1
Q

how can computational problem be represented abstractly

A

input–> computational problem–> output.
INPUT: info relevant to a problem which can be passed as a parameter to a subroutine
OUTPUT: solution to the problem, which can be passed back from a subroutine

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

first step in constructing a solution to computational problem

A

clear statement of inputs and outputs and name in documentation

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

in order to make sure program doesn’t crash

A

specify preconditions with the DOCUMENTATION of the function eg len(list)>1

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

adv of specifying preconditions

CCR

A
  • specifying as part of documentation ensures user knows what Checks (if any) to carry out before calling subroutine
  • no preconditions: user confident that all Checks will be performed in the subroutine, saving unnecessary Coding. makes Code easier to DEBUG AND MAINTAIN
  • clear documentation of inputs/outputs/preconditions makes subroutine Reusable in different programs if in a library of subroutines
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Reusable libraries examples

A
  • Windows DLL: dynamic link library- package of reusable program COMPONENTS
  • programming languages have libraries of common functions eg generating random number, sqrt
  • create own library
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

why have own libraries

A

if have ABSTRACT data types eg queues: adding/deleting etc needed in lots of different modules so useful to have written, debugged and thoroughly tested code saving TIME

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

Caching

A

temp storage of data and program instructions recently used and may be needed shortly eg last few instructions of a program for fast retrieval. done AUTOMATICALLY by operating system

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

web caching

A

storage of HTML pages and images recently looked at. Gives fast access to pages recently looked at and saves using bandwidth unnecessarily as saves having to download pages again

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

benefits of libraries

A

pre tested and error free
saves time as it is ready for use
written by experts
can be written in a different language

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