2.1.2 Thinking Ahead Flashcards

1
Q

What is the purpose of thinking ahead?

A

To make programs easy and intuitive for users to use.

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

Define inputs

A

Data which is entered into the system by the user.

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

Define outputs

A

The results that are passed back once the inputs have been processed.

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

What considerations do programmers need to make regarding inputs and outputs when thinking ahead?

A
  • Method of input/output
  • Data structures used
  • Data types used
  • Order of data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are preconditions?

A

Requirements which must be met before a program can be executed.

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

Where can preconditions be defined?

A

Within the code or within documentation.

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

Examples of where preconditions are required

A

Stack functions
- Check that a stack is not empty when popping an element
Factorial functions
- The number passed in cannot be negative.

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

Advantages of including preconditions within the documentation accompanying a subroutine

A
  • Reduces length of program
  • Reduces complexity of program
  • Saves time needed to debug and maintain a longer program
  • Makes subroutines more reusable.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Define caching

A

The process of storing instructions or values in cache memory after they have been used, as they may be used again.

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

Benefit of caching

A

Saves time which would have been needed to retrieve and store the instructions from secondary storage again

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

How is caching used in storing web pages?

A

Frequently accessed web pages are cached, so the next time one of these pages is accessed, content can be loaded without any delay.

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

Advantages of caching web pages

A
  • Content loaded without delay
  • Frees bandwidth for other tasks on a network
  • Images and text do not have to be downloaded again multiple times
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is prefetching?

A

Algorithms predict which instructions are likely to soon be fetched. They are loaded and stored in cache before they can be fetched.

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

Caching limitations

A
  • How accurate the caching algorithms are
  • How effective the algorithms are in managing cache
  • Size of cache
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Give three advantages of using reusable program components

A
  • More reliable than new components, as they have already been tested.
  • Time and money is saved, as you do not need to develop from scratch.
  • Can be used in future projects
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Examples of reusable program components

A
  • Classes
  • Subroutines
  • Abstract data structures (eg queues,stacks)