Topic 1 Flashcards

1
Q

Define the term ‘algorithm’

A

A series of instructions that describes how to solve a specific problem

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

Define the term ‘pseudocode’

A

A cross between English and a generic-looking programming language. While pseudocode would not compile, a competent programmer could convert it to code that would compile.

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

Define the term ‘flow chart’

A

A means of defining an algorithm using shapes and arrows

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

Define the flow chart shape ‘terminator’

A

Is used to mark the start, and another is used to mark the end. They are not used anywhere else

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

What do arrows do in flow charts?

A

Arrows show which instruction should take place next

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

Define the flow chart shape ‘decision’

A

It asks a question, and each arrow leaving this shape must have one possible answer to the question written alongside it

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

Define the flow chart shape ‘process’

A

Each one contains a single instruction, so complex tasks usually incorporate several processes.

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

Control structures:

Define ‘sequence’

A

When instructions in an algorithm each need to be executed only once, and in the order in which they are written

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

Control structures:

Define ‘selection’

A

When one sequence of instructions or another, but not both, is executed. The sequence that is executed will depend on what happened in earlier instructions.

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

Control structures:

Define ‘iteration’

A

Takes place when one or more instructions is executed more than once. Iteration is also known as repetition. Iteration is taking place when program code (or pseudocode) contains the words LOOP, FOR, WHILE or REPEAT.

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

Define ‘trace table’

A

Used to keep track of variables that change throughout the algorithm

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

Define ‘standard algorithm’

A

One the would appear in many different programs. It is an algorithm required so often, in so many applications, that virtually all software developers know exactly how it works and how to program it.

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

Define ‘sorting’

A

Putting data into order, whether that be numerical order, alphabetical order or chronological order, ascending (A-Z) or descending (Z-A)

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

Bubble sort ( 4 2 7 5 3 )

A

First pass:
( 2, 4, 7, 5, 3 ) – 2 and 4 been switched bc 4 is greater than 2
( 2, 4, 7, 5, 3 ) – 4 and 7 not switched bc they are already in order
( 2, 4, 5, 7, 3 ) – 5 and 7 been switched bc 7 is greater than 5
( 2, 4, 5, 3, 7 ) – 3 and 7 been switched bc 7 is greater than 3
This then continues til it gets to ( 2, 3, 4, 5, 7, 3)

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

Merge sort ( 4 9 5 1 3 2 7 8 )

A
Split:
(4) (9) (5) (1) (3) (2) (7) (8)
Pair:
(4 9) (5 1) (3 2) (7 8)
Pairs merged into groupings of four:
(4 9) (5 1) 
4 and 1 compared and the smallest is 1 leaving (1)
5 and 4 compared= (1 4)
9 and 5 compared= (1 4 5 9)
Same goes for (3 2 7 8)......(2 3 7 8)
(1 4 5 9) (2 3 7 8) the compared:
1. (1)
2. (1 2)
3. (1 2 3)
4. (1 2 3 4)
...
8. (1 2 3 4 5 7 8 9)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly