T6 - Flowcharts/Pseudo-code Flashcards
Variable
- location in memory in which you can temporarily store a value such as a string
or number
Algorithm
- series of steps to solve a problem or carry out a task
Sub programs
- used when you wish to call another procedure or function
three programming constructs used to control the flow of a program:
Sequence
Selection
Iteration (repetition)
Sequence:
A sequence is a series of steps which are completed one after the other
statements are executed one by one, in the order they are written
Selection:
is the ability to choose different paths through a program
In flowcharts, decision symbols are used for selection
Iteration:
means repeating a part of a program
- repeating or looping
eg of iteration
for … next
while … endwhile
do … until (doesn’t exist in python)
Boolean operators:
>
greater than = greater than or equal to < less than <= less than or equal to == equal to != not equal to
integer
whole number
real
number with a decimal point
boolean
true or false value
character
single alphabetic / numeric character
string
sequence of one or more characters
Pseudocode:
kind of structured English for describing algorithms
allows a programmer to focus on the logic of the algorithm without being distracted by the exact syntax of the programming language
Selection:
An IF statement is a type of selection statement
The next statement to be executed depends on whether the condition being tested is TRUE or FALSE
The switch/case statement
- used if there are several possible options to be tested
Do… until loop:
Use this when you want to keep on executing a loop until a certain condition is TRUE
The condition is tested at the end of the loop
How to find mistakes in programmes:
trace tables
Use a trace table:
programmer goes through the code, line by line, writing down the values of variables
Trace tables:
determine the outputs from a program as it runs
enable a programmer to find errors in their programs
Advantages of trace tables:
Determining the purpose of an algorithm
Finding the output of an algorithm
Finding errors in an algorithm
Drawing trace tables:
make a column for each variable used, in the order in which they appear
You don’t need to fill in a value for a variable which does not change in a particular row
A row is used for each iteration
Logical error -
when programmes work but gives a result that wasn’t intended by the programmer.
the logic of the program is incorrect
Syntax error
- programme won’t work
doesn’t follow the rules of the language
Sequence in flow chart
In a flow diagram they are shown as process, input or output symbols shown one after the other
Iteration in flow charts
In flowcharts, iteration = arrows that repeat a section of the flowchart
A decision will control whether more iterations are required