7.2 Creating algorithms Flashcards

1
Q

Input

A

An input is data or information being entered/taken into a program before it is processed in the algorithm.
An input can come from a variety of sources, such as:
User - keyboard, mouse, controller, microphone
Sensors - temperature, pressure, movement

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

Process

A

A process is a doing action performed in the algorithm that transforms inputs into the desired output.
The central processing unit (CPU) executes the instructions that de fine the process.
An example would be:
Comparing two numbers
Calculating an average

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

Output

A

An output is the result of the processing in an algorithm and usually the way a user can see if an algorithm works as intended.
An output can take various forms, such as:
Numbers - result of calculations.
Text
Images
Actions - triggering events.

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

Structure diagrams

A

A structure diagram is a visual representation of problem decomposition.
A tool to show how a complex problem can be broken down into more manageable sub problems.
A planning tool for developers during the analysis of a problem.

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

Pseudocode

A

Pseudocode is a text based tool that uses short English words/statements to describe an algorithm.
Pseudocode is more structured than writing sentences in English, but is very flexible.

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

Flowcharts

A

Flowcharts are a visual tool that uses shapes to represent di fferent functions to describe an algorithm.
Flowcharts show the data that is input and output, the processes that take place and any decisions or repetition.
Lines are used to show the flow of control.

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

Syntax error

A

A syntax error is an error that breaks the grammatical rules of a programming language and stops it from running.
Examples of syntax errors are:
Typos and spelling errors
Missing or extra brackets or quotes
Misplaced or missing semicolons
Invalid variable or function names
Incorrect use of operators
Incorrectly nested loops & blocks of code

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

Logic errors

A

A logic error is where incorrect code is used that causes the program to run, but produces an incorrect output or result.
Logic errors can be di cult to identify by the person who wrote the program, so one method of finding them is to use Trace Tables.
Examples of logic errors are:
Incorrect use of operators (< and >)
Logical operator confusion (AND for OR)
Looping one extra time
Indexing arrays incorrectly (arrays indexing starts from 0)
Using variables before they are assigned
In nite loops

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

Trace tables

A

A trace table is used to test algorithms and programs for logic errors that appear when an algorithm or program executes.
Trace tables can be used with flowcharts, pseudocode or program code.
A trace table can be used to:
Discover the purpose of an algorithm by showing output data and intermediary steps.
Record the state of the algorithm at each step or iteration.

Each stage of the algorithm is executed step by step.
Inputs, outputs, variables and processes can be checked for the correct value when the stage is completed.

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

Flowchart symbols

A

Process - represented by a square
Input/output - represented by a parallelogram
Decision - represented by a diamond
Terminal - represented by an oval
Sub program - represented by three rectangles

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