1/27
Looks like no tags are added yet.
Condition-controlled Repetition
A kind of loop repeated until a condition is met - used when the number of times around the loop is not known before the loop is started.
Count-controlled Repetition
A kind of loop repeated until a count is met - used when the number of times around the loop is known before the loop is started.
the process of executing the algorithm outside the machine, either in the programmer's head or using pencil and paper.
Flowchart
Graphical method of representing an algorithm using shapes and arrows.
to check that the data entering a program, by any means, is fit for processing.
algorithms must be… (4)
unambiguous
finite
sequenced
solves problem / completes task
algorithms can be written in…
plain english
code / programming language
flow chart
flowchart symbols and their functions (4)
oval - start / end
rectangle - processes (eg: maths / assignment)
parallelogram - inputs / outputs
diamond - yes / no decision (condition) used for selection and repetition
boolean condition V arithmetic expressions
boolean conditions are for comparisons with the answer of yes or no
arithmetic expressions are calculations with a number answer
trace tables are read from … to … , … to …
trace tables contain columns for … and an … column to track the changes of these things in an … during a … …
top
bottom
left
right
variables
output
algorithm
dry run
pre condition loops / top test iteration
A loop where the condition is checked BEFORE the loop runs.
post condition loops / bottom test iteration
A loop where the condition is checked AFTER the loop runs, so the loop always runs at least once.
GAP FILL: general approach to validation (5)
create a (1) loop control variable called (2) and set it to (3)
start a (4) which executes all the time when (2) is still (3)
inside the loop we get the (5)
...and we check the (5)
...setting (2) to (6) if it is acceptable or printing an error message if not.
boolean
valid
false
loop
input
true
HARDER GAP FILL: general approach to validation (5)
create a (1) called (2) and set it to (3)
start a loop which (4)
inside the loop we get the (5)
...and we check the (5)
if (2) is (3) we… (6)
if (2) is True we… (7)
boolean loop control variable
valid
false
executes all the time while valid is still False
input
print an error message
leave it be
count controlled loops in flowcharts don’t have a while function, instead … is used which starts at … or … and is changed at the end of the loop with the expression …
a count variable
0
1
count = count + 1