Computer Science Paper 2 Notes
Computer Science Paper 2 Notes
Modules:
Loops:
1. A rogue value is a value used to terminate a sequence of values. The
rogue value is of the same data type but outside the range of normal
expected values.
TYPE BookType
Title : STRING
YoP : DATE
Price : REAL
ISBN : INTEGER
ENDTYPE
Text Files
1. A text file consists of a sequence of characters formatted into lines.
Each line is terminated by an end-of-line marker. The text file is
terminated by an end-of-file marker.
Stacks
1. When an element is popped (removed) from the stack, the
TopOfStackPointer will decrease to point to the element now at the
top of the stack.
2. When the stack is empty, TopOfStackPointer will have the value –1.
Queues
When the queue is empty, the EndOfQueuePointer will have the value –1.
Note: Stacks are ordered from 0 to # from bottom up, whereas queues are
ordered from top to bottom (though still being ordered from 0 to #)
Arithmetic Operators
The result of integer division is the whole number part of the division. For
example, 7 DIV 2 gives 3.
Loops
1. Count-Controlled Loops are For loops.
2. Post-Condition Loops are loops that execute the code within the
statements at least once, and this loop repeats as long as the
condition is False. (e.g. REPEAT ... UNTIL)
3. Pre-Condition Loops evaluate the condition before the loop starts
and repeats as long as the condition is True. (e.g. While loop)
Modules/Subroutines
1. BYRef (Variables) that are a parameter of a procedure actually
affects the variable value outside the scope of the procedure.
2. Parameters are defined as variables that are defined at a
function/procedure’s input variables.
3. Arguments are the variables/constants that are passed to the
function/procedure from the outside.
4. An interface refers to the whole process of passing in an argument
and it being used as the parameter defined.
The arrows going down represent the fact that the results from one stage are
input into the next stage. The arrows leading back up to an earlier stage
reflect the fact that often more work is required at an earlier stage to
complete the current stage.
Benefits include:
1. Simple to understand as the stages are clearly defined.
2. Easy to manage due to the fixed stages in the model. Each stage
has specific outcomes.
3. Stages are processed and completed one at a time.
4. Works well for smaller projects where requirements are very well
understood.
An iterative life cycle model does not attempt to start with a full specification
of requirements. Instead, development starts with the implementation of a
small subset of the program requirements. Repeated (iterative) reviews to
identify further requirements eventually result in the complete system.
Benefits Include:
In the RAD model, the modules are developed in parallel as prototypes and
are integrated to make the complete product for faster product delivery.
There is no detailed preplanning. Changes are made during the development
process.
The analysis, design, code and test phases are incorporated into a series of
short, iterative development cycles.
Benefits Include:
Drawbacks Include:
A semicircle shows that those modules will repeat until the condition is met.
Note that a structure chart does not give details about how parameters are
passed: by reference or by value.
Types of Errors
1. Syntax Errors
2. Logic Errors
3. Run-time Errors
Testing Methods
Stub Testing
Used for testing a structure of code (by print statements (or a procedure that
contains a print statement)) before the functions of the structure are coded
After that, typically the programmer will use debugging software or dry-
running have to be used to find the lines of code that need correcting.
Dry-running an Algorithm
The idea is to write down the current contents of all variables and conditional
values at each step of the algorithm.
Trace Table:
We only make an entry in a cell when an assignment occurs. Values remain
in variables until they are overwritten. So a blank cell means that the value
from the previous entry remains.
It is important to start filling in a new row in the trace table for each iteration
(each time around the loop).
Types of testing:
Integration Testing
o Software often consists of many modules, sometimes written by
different programmers. Each individual module might have
passed all the tests, but when modules are joined together into
one program, it is vital that the whole program is tested. a.k.a.
Integration Testing.
o Integration testing is usually done incrementally. This means
that a module at a time is added, and further testing is carried
out before the next module is added.
Alpha Testing
o It is where software is tested in-house by software testers before
being released to customers.
Acceptance Testing
o Bespoke software (written for a specific customer) will then be
released to the customer. The customer will check that it meets
their requirements and works as expected. This stage is called
acceptance testing.
o It is generally part of the hand-over process. On successful
acceptance testing, the customer will sign off the software.
Beta testing
o Where the software is being produced for general sale (no
specific customer).
o After alpha testing, a version is released to the beta testers
(limited users of the general public) to find errors on their end
and report it to the developers.
Flow of control: does the user get appropriate choices and does the
chosen option go to the correct module?
Validation of input: has all data been entered into the system correctly?
Do loops and decisions perform correctly?
Is data saved into the correct files?
Does the system produce the correct results?
Maintenance
Corrective Maintenance
Programs often get changed to make them perform functions they were not
originally designed to do.
Perfective Maintenance
The Dimond represents that only 1 out of the 3 methods will be run.
This is how a linked list (with both a data linked list and free linked list) is
implemented with arrays.