3.3 Algorithms and Programs Flashcards

1
Q

Algorithm

A

A series of steps to solve a specific problems.

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

3 methods of defining algorithms

A
  1. Flowcharts
  2. Pseudocode
  3. Structured English
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

2 advantages of flowcharts

A
  1. Easy to write
  2. Easy technique to understand logic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

2 disadvantages of flowcharts

A
  1. Time Consuming
  2. Difficult to show branching and looping
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

3 advantages of pseudocode

A
  1. Forces programmer to think through logic of code before writing
  2. Easier to understand the concept of a program.
  3. Easier to convert a flow diagram
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

2 disadvantages of pseudocode

A
  1. No accepted standard so varies wildly
  2. More difficult to follow logic in comparison to flowcharts
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

structured English

A

A cross between pseudocode and plain English.

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

Advantage of structured English

A

Easy for non-programmers to write.

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

2 disadvantages of structured English.

A
  1. No accepted standard so varies wildly
  2. Can be difficult to convert to code.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

variable

A

A named space in the memory for a single piece of data.

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

constant

A

A variable except the data can not be changed in the program.

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

two scopes of a variable

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

Global variable (2)

A

Available throughout the program
Can be read /written from any subroutine.

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

2 advantages of local variable

A

Variable data is only significant in the subroutine is it being used.
Encourages the use of modular programming

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

local variable

A

Only exists until the subroutine in which it was created.

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

2 advantages of global variable

A
  • Accessible to all the modules in the program e.g. Constants
  • You only have to declare it once
15
Q

2 disadvantages of global variable

A
  • Debugging harder as any statement in the code can alter the value.
  • Can discourage modular programming
16
Q

parameter

A

An item of data passed from one subroutine to another.

17
Q

3 techniques to make code readable

A
  1. Indentation
  2. Annotation
  3. Use of appropriate identifiers
18
Q

two ways of passing a parameter

A
  1. Passing by value.
  2. Passing by reference
19
Q
A
20
Q

passing by value (2)

A

The value is passed from one subroutine to another.
If value is changed by the subroutine, the original value is unchanged.

20
Q
A
21
Q
A
22
Q
A
23
Q
A
23
Q
A
24
Q
A
25
Q
A
26
Q
A
27
Q
A