Programming Concepts Flashcards

You may prefer our related Brainscape-certified 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

Any data that is required to solve a problem usually 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 and the problem solved.

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

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

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

Identify the inputs likely to be used in a book reservation system at a library.

A
  • Book details: name author ISBN
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
  • Borrower details: name library card number
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Identify the outputs likely to be used in a book reservation system at a library.

A
  • Expected waiting time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
  • Confirmation
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
  • Availability at other libraries
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
  • Collection point
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
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
15
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
16
Q

Give an example where preconditions are required.

A
  • Stack functions: Check that a stack is not empty when popping an element from a stack.
17
Q
  • Check that a stack is not full when pushing an element onto a stack.
A
18
Q
  • Factorial function: The number passed to the function cannot be negative.
A
19
Q

State two advantages of including preconditions within the documentation accompanying a subroutine.

A
  • Reduces the length of the program
20
Q
  • Reduces the complexity of the program
A
21
Q
  • Saves time needed to debug and maintain a longer program
A
22
Q
  • Makes subroutine more reusable.
A
23
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.

24
Q

How is caching used in storing web pages?

A

Web pages that a user frequently accesses are cached so the next time one of these pages is accessed content can be loaded without any delay.

25
Q

What are the advantages of caching web pages?

A
  • Content can be loaded without delay
26
Q
  • Images and text do not have to be downloaded again multiple times
A
27
Q
  • Frees bandwidth for other tasks on a network
A
28
Q
  • Less time is spent waiting.
A
29
Q

What is the name given to the technique in which algorithms are used to predict which instructions are likely to soon be used?

A

Prefetching.

30
Q

Give a limitation of caching.

A
  • Accuracy of the algorithms used
31
Q
  • Effectiveness of algorithm in managing the cache
A
32
Q
  • Size of the cache.
A
33
Q

Give three advantages of using reusable program components.

A
  • More reliable than new components as they have already been tested.
34
Q
  • As developing from scratch is not required this saves time money and resources.
A
35
Q

Give two examples of reusable program components.

A
  • Abstract data structures e.g. queues and stacks.
36
Q
  • Classes
A
37
Q
  • Subroutines.
A