Onslow St Audrey`s School

Onslow St Audrey’s School
Hatfield's Business and Enterprise Academy
3.2.1 DESIGNING SOLUTIONS TO PROBLEMS
a. discuss the importance of good interface
design;
b. design and document data capture forms,
screen layouts, report layouts or other forms of
input and output (e.g. sound) for a given problem;
c. determine the data requirements of a program
(relating to 3.2.3: Data types and data structures);
d. explain the advantages of designing a solution
to a problem by splitting it up into smaller problems
(top-down/modular design);
e. produce and describe top-down/modular
designs using appropriate techniques including
structure diagrams, showing stepwise refinement;
f. produce algorithms to solve problems;



Make sure you use (all) the space correctly
Make sure you use appropriate elements
e.g. textfields
Make sure all required elements are
included.

See 3.2.3



More manageable and maintainable
Different elements can be completed by
different people allocated according to
strengths.
Faster to completion with more people on
one project
Modules can be reused.

Practice algorithm traces / programming

Practice algorithm traces / programming

Make sure you use the correct shapes with the
correct number of inputs/outputs.
g. describe the steps of an algorithm using a
program flowchart;




Terminator – Start/Stop – 1I or 1O
Diamond – Decision – Yes/No – 1I & 2O
Rectangle – Process – 1I & 1O
Parallelogram – Input/Output – 1I & 1O
h. describe the steps of an algorithm using
pseudo-code;

Practice algorithm traces / programming



Create a simple solution first
Before adding layers of complexity
Good because there is something to show
quickly
Bad because program might develop in the
wrong direction.
i. understand, and implement algorithms and
evaluate them by commenting on their efficiency,
correctness and appropriateness for the problem
to be solved;
j. describe the use of Rapid Application
Development (RAD) as a design strategy,
including prototyping and iterative development,
and state its advantages and disadvantages.

3.2.2 THE STRUCTURE OF PROCEDURAL PROGRAMS
a. define and correctly use the following terms as
they apply to procedural programming: statement,
subroutine, procedure, function,
parameter/argument, sequence, selection,
iteration/repetition, loop;


Statement – a standalone line of code that
does something.
see below
Sequence
b. identify the three basic programming constructs
used to control the flow of execution, ie sequence,
selection and iteration;





The order of your instructions is important
The wrong order will result in the incorrect
output.
Instructions can be nested inside each other
using Iteration and Selection
Making choices about which code block is
executed.
A condition is tested – if true a certain codeblock is executed.
If, Then, Else + Else If

c. understand and use selection in pseudo-code
and a procedural programming language,
including the use of IF statements and
CASE/SELECT statements;


Select Case (Switch Case)



A variable is selected and tested against
different case conditions.
If the select matches the case then the code
block executes
Default option that executes if none of the
conditions are met.
Can replace multiple Ifs
Good for simple comparisons



Repeating blocks of code.
Making your code more extendable.
Solving problems in a more efficient way.


d. understand and use iteration in pseudo-code
and a procedural programming language,
including the use of count controlled loops (FORNEXT loops) and condition-controlled loops
(WHILEENDWHILE and REPEAT-UNTIL loops);
Tests condition, if true branches to true code
block
Else tests for else if condition
Or branches to Else code block if available
For Loops



Count Controlled
Always runs fixed number of times
Increment can be neg/pos or multiples
While Do


Condition Controlled
Repeats while a condition is true

Condition comes first – codeblock might not
run.
Repeat Until (Do While)
e. understand and use nested selection and
iteration statements;



Condition Controlled
Repeats while a condition is true
Condition comes last – code always runs
once.

Selection and Iteration statements can be
placed inside each other allowing for more
complex processing.
For example an IF statement could be put
inside a For loop so it is executed at every
step of the loop.

Sub Routines
f. understand, create and use subroutines
(procedures and functions), including the passing
of parameters and the appropriate use of the
return value of functions
g. identify and use recursion to solve problems;
show an understanding of the structure of a
recursive subroutine, including the necessity of a
stopping condition;
h. trace the execution of a recursive subroutine
including calls to itself;
i. discuss the relative merits of iterative and
recursive solutions to the same problem.








Small modules (code blocks) that perform
self contained operations
Input values can be passed to sub-routines
as parameters
Procedures – Does not return a value
Function – Does return a value
A function that calls itself
Must have a stopping condition
Head Recursion – the recursive call comes
at the top
Tail Recursion – the recursive call comes at
the end

Practice algorithm traces / programming

Recursion provides simple and elegant
solutions to some problems
Can be expensive because of repeated
function calls.

3.2.3 DATA TYPES AND DATA STRUCTURES
a. define different data types, eg numeric (integer,
real), Boolean, character and string; select and
use them appropriately in their solutions to
problems;





Integer – whole number e.g. 7
Real/Double – decimal e.g. 3.14
Boolean – true/false
Char – single alphanumeric character e.g.
‘a’
String – array of chars e.g. “FooBar”
b. define and use arrays (one and twodimensional) for solving simple problems,
including initialising arrays, reading data into
arrays and performing a simple serial search on a
one-dimensional array;

TimeStamp – number of milliseconds since
1 Jan 1970

Single variable is like a wardrobe
 An Array is a chest of drawers.
 2D Array – chest of drawers with
compartments
Has Index that points to the location/position
Normally starts from zero.



c. explain the advantages and disadvantages of
different data types and data structures for solving
a given problem;
d. design and implement a record format;
e. define different modes of file access: serial,
sequential, indexed sequential and random; and
justify a suitable mode of file access for a given
example;
f. store, retrieve and search for data in files;




You should be familiar with approximate
sizes of the different data types.
A char is one byte – think ASCII
A string of 6 letters would be 6 bytes.
A number will be 2,4 or 8 bytes.
Boolean will be 1 byte

You should have practiced this in lessons




Serial
Sequential
Index Sequential
Random



g. estimate the size of a file from its structure and
the number of records;
h. use the facilities of a procedural language to
perform file operations (opening, reading, writing,
updating, inserting, appending and closing) on files
of different access modes as appropriate.


You should have practiced this in lessons
Use your knowledge of data types to
calculate a per row size.
Multiple the per row size by the
estimated/total number of rows
Add 10% for overheads.
Resize into a suitable MB/KB/GB using
1024.

You should have practiced this in lessons

= means equals – the variable becomes
that value.




Add +
Subtract Multiple *
Divide /
3.2.4 COMMON FACILITIES OF PROCEDURAL
LANGUAGES
a. understand and use assignment statements;
b. understand arithmetic operators including
operators for integer division (+, -, *, /, MOD and
DIV) and use these to construct expressions;


Mod – the remainder from division
e.g. 14MOD5 = 4
Div – whole division e.g. 14DIV5 = 2






== Comparison
< Less Than
<= Less Than or Equal To
> Greater Than
>= Greater Than or Equal To.
<> or != Not Equal To




AND – both must be true
OR – one or other or both must be true
XOR – only one or other not both
NOT – the opposite e.g True becomes False
e. understand the effects of the precedence of
standard operators and the use of parentheses to
alter the order of precedence;

BODMAS
f. evaluate expressions containing arithmetic,
relational and Boolean operators and parentheses;

You should have practiced this in lessons







<left< li=""></left<>
Mid
Right
Replace
Length
ASCII
Char


7 != ‘7’ because of ASCII Codes
Have to cast ‘7’ into an int

Validation – checking something is sensible
but not necessarily correct.
 Length
 Type
 Format
Validation – checking it is correct
 Double Entry
c. understand a range of relational operators, e.g.
==, <, <=, >, >= and <> and use these to construct
expressions;
d. understand the Boolean operators AND, OR
and NOT and use these to construct expressions;
g. understand and use a range of operators and
built-in functions for string manipulation, including
location (LOCATE), extraction (LEFT, MID,
RIGHT), comparison, concatenation, determining
the length of a string (LENGTH) and converting
between characters and their ASCII code (ASCII
and CHAR);
h. understand that relational operations on
alphanumeric strings depend on character codes
of the characters and explain the results of this
effect (eg why ‘XYZ’ < ‘abc’, ‘2’ > ‘17’ and ‘3’ <>
‘3.0’);
i. input and validate data;

j. output data onto screen/file/printer, formatting
the data for output as necessary.

You should have practiced this in lessons

Variable – named location in memory, given a
data type and initial value. Can change during
run time.
Constant – like a variable but cannot change.
3.2.5 WRITING MAINTAINABLE PROGRAMS
a. define, understand and use the following terms
correctly as they apply to programming: variable,
constant, identifier, reserved word/keyword;


Identifier – the name given to variables, constants
and sub-procedures.

Reserved Keyword – a word reserved for
use by the programming language e.g. int
and while.
So another person can perform:
b. explain the need for good program-writing
techniques to facilitate the ongoing maintenance of
programs;



upgrade
maintenance
repairs
on your code.
c. declare variables and constants, understanding
the effect of scope and issues concerning the
choice of identifier (including the need to avoid
reserved words/keywords);

You should have practiced this in lessons
d. select and use meaningful identifier names and
use standard conventions to show the data types
and enhance readability;

You should have practiced this in lessons
e. use declared constants to improve
maintainability;

You should have practiced this in lessons


So that previous values cannot affect the
operation of the program.
You should have practiced this in lessons

You should have practiced this in lessons

Comments should be written in plain
language to aid understanding of the code.
Every 1 to 10 lines depending on the
complexity of the code.
Multi-line and single line comments
f. initialise variables appropriately, before using
them;
g. create appropriately modularised programs
(following a top-down/modular design as produced
in 3.2.1: Designing solutions to problems) making
effective use of subroutines to improve
maintainability;
h. annotate the code with comments so that the
logic of the solution can be followed;


i. use indentation and formatting to show clearly
the control structures within the code.

Indents show code-blocks nested within
Selection and Iteration statements.

Syntax – Breaks the rules of the
programming language. Program will not
compile. E.g. missing brackets.
RunTime – Program will run but crash due
to an unprotected error e.g. a missing
configuration file.
3.2.6 TESTING AND RUNNING A SOLUTION
a. describe types of errors in programs (syntax,
logic and run-time errors) and understand how and
when these may be detected;

b. identify why/where an error may occur in an
algorithm and state how the algorithm may be
corrected;

Logic – The program runs but produces
unexpected outputs due to incorrect logic
e.g. less than rather than less than or equal.

You will want to be able to identify errors in
algorithms
You should have practiced this in lessons




c. describe testing strategies including white box
testing, black box testing, alpha testing, beta
testing and acceptance testing;





Normal – expected to work
BorderLine – expected to work or error but
on the extremes e.g. first and last items in
an array.
Invalid – a test that is expected to fail

You should have practiced this in lessons
d. select suitable test data for a given problem,
including normal, borderline and invalid data;
e. perform a dry run on a given algorithm, using a
trace table;
White Box – algorithm traces
Black Box – Checking input against output.
Alpha Testing – In House testing by
developers
Beta Testing – Limited external testing by
trusted persons.
Acceptance Testing – Completed by the
company prior to signing off/payment.