Algorithms 2.1 Flowcharts, Pseudocode, structure diagrams Flashcards

1
Q

Define flowchart

A

A flowchart is a method of representing the sequences of steps in an algorithm in the form of a diagram

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

State the different symbols that make up a flowchart and draw what they look like

A

Terminal
Process
Decision
Input/Output
Sub routine
Line

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

What does the Terminal symbol in a flowchart represent

A

Terminal symbol – represents the start of end of a process

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

What does the Process symbol in a flowchart represent

A

Process symbol – represents something being initialized, processed or calculated.

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

What does the Decision symbol in a flowchart represent

A

Decision symbol – represents the decision. It will have a yes or no, true or false outcomes which will be represented by two separate lines or paths exiting the shape.

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

What does the Input/Output symbol in a flowchart represent

A

Input/Output symbol – represents the input and output of data to the algorithm

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

What does the Sub routing symbol in a flowchart represent

A

Sub routing symbol – representing a call to a sub routine. A sub routine will have its own flowchart, but when you call it from the main program, you need to express that call using this symbol

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

What does the Line symbol in a flowchart represent

A

Line (with an arrow) - represents the control passing between connected shapes. It is the flow of the algorithm

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

Define pseudocode

A

Pseudocode is an alternative, text-based way of representing the sequence of steps in an algorithm

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

What does the prefix, pseudo mean

A

The prefix ‘pseudo’ means false or not genuine

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

State an advantage of pseudocode

A

Pseudocode allows us to lay down the logic of a problem in an almost-like-real-code way without worrying about the actual rules and syntax of a particular language

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

Create a flowchart asking the user to input two numbers, and display to the screen the larger number

A

file:///C:/Users/44748/Documents/flowcharts%20and%20pseudocode.pdf

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

Create an algorithm in pseudocode, equivalent to the flowchart
file:///C:/Users/44748/Documents/flowcharts%20and%20pseudocode.pdf

A

number1 = INPUT ()
number2 = INPUT ()

if number 1 > number 2 then
print(“The largest number is” + number1)
else
print(“The largest number is” + number2)
endif

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

When refining an algorithm what do you need to do

A

Step 1) Identify the areas of existing algorithm which need modifying

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

QUESTION: Refine this algorithm to output the largest of the three numbers entered by the user.

file:///C:/Users/44748/Documents/flowcharts%20and%20pseudocode.pdf

A

file:///C:/Users/44748/Documents/flowcharts%20and%20pseudocode.pdf

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

Create a flowchart which calculates how much carbon to dose into a fish tank to keep nitrate levels safe. If the nitrate level is above 10 dose 3ml of carbon. If the nitrate level is above 2.5 and smaller than 10 dose 2ml, if the nitrate level is above 1 but smaller than 2.5 dose 1ml is the nitrate level is below 1, dose 0.5ml

A

file:///C:/Users/44748/Documents/flowcharts%20and%20pseudocode.pdf

17
Q

Create an algorithm in pseudocode, equivalent to the flowchart

A

file:///C:/Users/44748/Documents/flowcharts%20and%20pseudocode.pdf

18
Q

Describe the pseudocode/flow char fish algorithm
file:///C:/Users/44748/Documents/flowcharts%20and%20pseudocode.pdf

A

This is a comment to explain the purpose of the program
The user is asked to enter the nitrate level, this value is stored in the variable:nitrate
If nitrate is greater than 10 then Then does 3ml
Otherwise if nitrate is greater than 2.5, Dose 2ml
Otherwise if nitrate is greater than 1 Dose 1ml
Otherwise dose 0.5ml

19
Q

What does 6 MOD 2 mean

A

6/2 = 3, there is no remainder, therefore the modulus of 6 MOD 2 would equal 0

20
Q

What does 7 DIV 2 mean

A

DIV – Quotient (integer division) e.g. 7 DIV 2 = 3. It disregards any decimal places that are a result of the division.

21
Q

What is the method, Structure diagrams are produced by called?

A

Structure diagrams are produced using a method known as step-wise refinement

22
Q

Describe step-wise refinement

A

We break the problem down using decomposition into smaller and smaller components

Some areas of the program will need breaking down more than others

The lowest level nodes should achieve a single task

These can be then be coded as a single module or sub-program

23
Q

What do structure diagrams look like

A

file:///C:/Users/44748/Documents/structure%20diagram.pdf