0% found this document useful (0 votes)
4 views

p2 stuff cs

The document is a comprehensive mark scheme and notes for a Computer Science syllabus, detailing key concepts such as computational thinking, algorithms, data types, and programming basics. It includes explanations of abstraction, decomposition, and the use of data structures like arrays and records, along with pseudocode examples. Additionally, it covers the program development life cycle and design principles, emphasizing the importance of structured programming and testing methods.

Uploaded by

hsnalttr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

p2 stuff cs

The document is a comprehensive mark scheme and notes for a Computer Science syllabus, detailing key concepts such as computational thinking, algorithms, data types, and programming basics. It includes explanations of abstraction, decomposition, and the use of data structures like arrays and records, along with pseudocode examples. Additionally, it covers the program development life cycle and design principles, emphasizing the importance of structured programming and testing methods.

Uploaded by

hsnalttr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

9618 Computer Science Mark Scheme

Notes
Compiled by Carol M. S. Dandira
- Most of the notes are taken from Mark Schemes
- Where the notes are not taken from the mark schemes, I
explicitly specify the source
- The notes are in the order the syllabus points appear in the
syllabus… I didn’t skip any syllabus point between topic 9 to 12
- Please also use this in conjunction with the pseudocode guide
- Where context is needed, I include the question along with the
mark scheme answer
9.1 Computational Thinking Skills
Show an understanding of abstraction:
• Need for and benefits of using abstraction
They make the program more easier to understand / debug / maintain

• Describe the purpose of abstraction
A system is being developed to help manage a car hire business. A customer may hire a car for a number of
days.
An abstract model needs to be produced.
(a) Explain the process of abstraction and state four items of data that should be stored each time a car is
hired.
Abstraction is used to filter out information / data that is not necessary for the task
To keep only information / data that is necessary for the task

1. Car details: ID, Car Registration, car type etc Customer details: ID, name, address, licence details
etc
2. Start date (of hire)
3. Return date / Number of days (of hire)
4. Cost of hire

• Produce an abstract model of a system by only


including essential details

This says a lot about abstraction: https://lsrsssgroup.wordpress.com/wp-content/uploads/2020/04/9.1a-computational-thinking-skills-


abstraction.pdf

Describe and use decomposition


Breaking down a problem / task into sub problems / steps / smaller parts
In order to explain / understand // easier to solve the problem
Leading to the concept of program modules // assigning problem parts to teams
Reasons for breaking a problem into sub tasks:
Subtasks make the solution more manageable // make the algorithm easier to follow
A subtask makes the problem easier to solve / design / program than the whole task
A subtask is useful when a part of the algorithm is repeated

• Break down problems into sub-problems leading


to the concept of a program module (procedure /
function)
Why it is good practice to use modules:

To make a more manageable / understandable solution


Subroutine may be (independently) tested and debugged
Program is easier to maintain

changes needed to convert one of the existing modules into this single
module: Parameters need to be passed to the module
Search algorithm is controlled by (global) variables / parameters

Advantages and disadvantages of turning modules into a single module:


Advantage:
o Only have to change one module if specification changes
o Less repetitive code / fewer lines of code
o Aids re-usability
Disadvantage:
o Single module more complex / more error prone / more difficult to debug ...
o Single module cannot be split among programmers / teams
9.2 Algorithms
Show understanding that an algorithm is a solution to
a problem expressed as a sequence of defined steps

an algorithm is a solution to
a problem expressed as a sequence of defined steps

Use suitable identifier names for the representation


of data used by a problem and represent these
using an identifier table – for documenting variables
A suitable identifier:
The name reflects / indicates the purpose of the variable // the names are meaningful
Why we need it
They make the program more easier to understand / debug / maintain

Refer to the insert for the list of pseudocode functions and operators.
1 (a) A program is being developed to help manage the membership of a football club.
Complete the following identifier table.

Write pseudocode that contains input, process and


Output

Write pseudocode using the three basic constructs


of sequence, selection and iteration (repetition)
Sequence is basically executing the steps in order, selection is the IF, ELSE, END IF statement, and iteration consists of count-
controlled (FOR), post-condition (REPEAT) and pre-condition (WHILE). (This description isn’t from a mark scheme)

Document a simple algorithm using a structured


English description, a flowchart or pseudocode

Write pseudocode from:


• a structured English description

• a flowchart
-follow the arrows. Where there is a rectangle with two vertical lines on each width, that’s a subroutine and it is basically
either a function or a procedure.

Draw a flowchart from:


• a structured English description
An algorithm will:
1. input an integer value
2. jump to step 6 if the value is zero
3. sum and count the positive values
4. sum and count the negative values
5. repeat from step 1
6. output the two sum values and the two count values.
Draw a program flowchart on the following page to represent the algorithm.
Note that variable declarations are not required in program flowcharts.

A program will:
input 50 unique integer values output the largest value
output the average of the values excluding the largest value.
Draw a program flowchart to represent the algorithm.
Variable declarations are not required.
It is not necessary to check that each input value is unique.

• pseudocode (actually easier to use pseudocode than the structured English)

Describe and use the process of stepwise


refinement to express an algorithm to a level of
detail from which the task may be programmed
 to increase the level of detail of the algorithm // break the problem into
smaller steps
 until steps are easier to solve // to be directly translated into lines of
code

Use logic statements to define parts of an algorithm


solution
Using logic statements in an algorithm means expressing decisions and conditions using formal logical operators like AND, OR, and NOT
to clearly define when certain actions should occur. (Taken from chat gpt)

10.1 Data Types and Records


Select and use appropriate data types for a problem
Solution:
• including integer, real, char, string, Boolean, date
• (pseudocode will use the following data types:
INTEGER, REAL, CHAR, STRING, BOOLEAN,
DATE, ARRAY, FILE)

Show understanding of the purpose of a record


structure to hold a set of data of different data types
under one identifier
Benefits of an array of records:
Allows for iteration / can use a loop to access the records / data items
Use of index to directly access a record in the array // Example of simplification of code e.g. use of dot notation
Item[1].Stage
Simplifies the code / algorithm // Reduces duplication of code // Program easier to write / understand / maintain /
test / debug // Data items/record easier to search / sort / manipulate
a record
structure to hold a set of data of different data types
under one identifier

• Write pseudocode to define a record structure


Write pseudocode to declare the record structure for type Student:

TYPE Student
DECLARE StudentID : STRING
DECLARE Email : STRING
DECLARE Club_1 : INTEGER
DECLARE Club_2 : INTEGER
DECLARE Club 3: INTEGER
ENDTYPE

• Write pseudocode to read data from a record


structure and save data to a record structure
- Refer to pseudocode guide, it’s has a good example in the record section

10.2 Arrays
Use the technical terms associated with arrays:
• Including index, upper and lower bound
Select a suitable data structure (1D or 2D array) to
use for a given task
appropriate way of indicating an unused array element.
Assign a value (of the correct data type) outside the normal range
Explain why it would be good practice to use arrays to store the data.
.. Algorithm to process / search / organise the data is easier to implement
// Values may be accessed via a loop-controlled variable / iterated
through using index
Makes the program easier to design / code / test / understand
Multiple instances referenced via a single identifier / so fewer identifiers needed // Easier to amend the program
when the number of students increases
Write pseudocode for:
1D arrays
DECLARE Membership : ARRAY [1:3000] OF Student // array of 3000 students
2D arrays
This algorithm is efficient because (A flag is used to) exit the loops // iteration is terminated as soon as a Screen
element with value 1 is found

Write pseudocode to process array data:


• Sort using a bubble sort

• Search using a linear search


10.3 Files
Show understanding of why files are needed
how the program could use text files to speed up the process.
• • Data from the arrays is written to the files at the end of the day / before the program is
terminated / computer is switched off
• Data can then be read from the files at the start of the next day and written to stored in the
arrays
• No need to (re-)enter the data manually I/ only need to enter data once
Non-Volatile:
The data is retained when the program is terminated / after the computer is switched off // data is stored
permanently // non-volatile storage

How data can be stored in a text file:


• Data items are combined to form a single string / saved as a single line in the file
• Data items are separated by a special character // make each data item a fixed length
Write pseudocode to handle text files that consist of
one or more lines

A procedure Preview() will:


Take the take the name of the text file as a parameter
output a warning message if the file is empty
otherwise output the first five lines from the file (or as many lines as there are in the file if this number is less than
five).
Write pseudocode for the procedure Preview ()
10.4 Introduction to Abstract Data Types
(ADT)
Show understanding that an ADT is a collection of
data and a set of operations on those data
an ADT is a collection of
data and a set of operations on those data

Show understanding that a , queue and linked


list are examples of ADTs:
• Describe the key features of a stack, queue and
linked list and justify their use for a given situation
Linked list

Use a stack, queue and linked list to store data:


• Candidates will not be required to write pseudocode

for these structures, but they should be able to:


add
Adding to a stack:

Adding to a queue:

Adding to a linked list:

edit
delete data from these structures

Describe how a queue, stack and linked list can be


implemented using arrays
Queue

A module AddIo () will add a value to the queue by manipulating the array and variables in part (a).
The queue implementation is circular. When pointers reach the end of the queue, they will wrap around' to the
beginning
Before a value can be added to the queue, it is necessary to check the queue is not full.
The algorithm to add a value to the queue is expressed in six steps.
Complete the steps.

Stack

Linked List:
An array (1D) to store the data and a second array (1D) to store the pointers
An (integer) variable to hold the start pointer and an (integer) variable to store the next free pointer
11.1 Programming Basics
Implement and write pseudocode from a given
design presented as either a program flowchart or
structured English
Write pseudocode statements for:
o the declaration and initialisation of constants
CONSTANT Pi =3.142
o the declaration of variables
DECLARE <Variable Name>: <Data type>
o the assignment of values to variables
<variable name> <- <value>
o expressions involving any of the arithmetic or
logical operators input from the keyboard and
output to the console

Use built-in functions and library routines :


Benefits of using built-in functions:
Saves development time / no need to write it / can't write it....
Pre-compiled and tested / Increased reliability / reduces chance of error
Is available to all programs

• Any functions not given in the pseudocode guide


• will be provided
• String manipulation functions will always be given

11.2 Constructs
Use pseudocode to write:
o an ‘IF’ statement including the ‘ELSE’ clause
and nested IF statements
o a ‘CASE’ structure
- refer to pseudocode guide please
o a ‘count-controlled’ loop:
o a ‘post-condition’ loop (REPEAT… UNTIL <condition>)
o a ‘pre-condition’ loop

Justify why one loop structure may be better suited


to solve a problem than the others

The loop structure used in the pseudocode is not the most appropriate.
State a more appropriate loop structure and justify your choice.
Structure: A count-controlled loop
Justification: The number of iterations is known // repeats for the length of
InString

11.3 Structured Programming


Define and use a procedure

Explain where in the construction of an algorithm it


would be appropriate to use a procedure

Use parameters:
• A procedure may have none, one or more
parameters
• A parameter can be passed by reference or by value
By reference / ref
The address of / pointer to the parameter is passed to the subroutine // if the parameter value is
changed in the subroutine this changes the original value

Define and use a function

Explain where in the construction of an algorithm it


is appropriate to use a function:
• A function is used in an expression, e.g. the return
value replaces the call

Use the terminology associated with procedures


and functions:
• including procedure / function header, procedure /
function interface, parameter, argument, return value

Write efficient pseudocode

12.1 Program Development Life cycle


Show understanding of the purpose of a
development life cycle
Show understanding of the need for different
development life cycles depending on the program
being developed:
Including:
• Waterfall

Taken from David Watson, and Hellen Williams textbook)

• Iterative
Taken from David Watson, and Hellen Williams textbook)

• rapid application development (RAD)


A software company is working on a project to develop a website for a school.
The school principal has some ideas about the appearance of the website but is unclear about all the
details of the solution. The principal would like to see an initial version of the website.

(i) Identify a life cycle method that would be appropriate in this case.
Give a reason for your choice.

Life cycle method: Iterative // Rapid Application Development (RAD)


Reason: Provides a working model / prototype at an early stage for the
principal to approve / review
Taken from David Watson, and Hellen Williams textbook)

Describe the principles, benefits and drawbacks of


each type of life cycle
Waterfall

Iterative or RAD is more suitable for the task


Show understanding of the analysis,
Design:
activities that will take place during the design stage of the program development life cycle:
Data structures
Algorithms / flowcharts / pseudocode
Program structure (modules) / use of library routines / module - team allocation
User interface // Web-page layout / content (for given scenario)
Testing method / plan
Choice of programming language / program environment

Coding:
The program or set of programs is written using a suitable programming
language.

testing
The program is run many times with different sets of test data, to test that
it does everything it is supposed to do in the way set out in the program
design.

maintenance
The program is maintained throughout its life, to ensure it continues
to work effectively. This involves dealing with any problems that arise
during use, including correcting any errors that come to light, improving
the functionality of the program, or adapting the program to meet new
requirements. (From textbook)

12.2 Program Design


Use a structure chart to decompose a
problem into sub-tasks and express the
parameters passed between the various
modules / procedures / functions which are part of
the algorithm design:
• Describe the purpose of a structure chart

• Construct a structure chart for a given problem

Purpose of the curved arrow:


iteration / looping
naming all four modules correctly in the correct sequence // e.g.
Module-A repeatedly calls Sub-Y1, then Sub-Y2 then Sub-9

• Derive equivalent pseudocode from a structure


chart

PROCEDURE LoanReturn (LoanID, BOOkID : STRING, BYREF Fine : REAL)


Show understanding of the purpose of state-transition diagrams to document an algorithm
o Graphical representation of a system's states and the transitions between those states.
o Used to model the behavior of a system, especially where the system's output depends on its current
state and input events.
o Useful in designing and understanding algorithms for systems with multiple states, like finite state
machines.
Helps in visualizing the control flow and ensuring that all possible states and transitions are accounted
for.
Source: https://daniel-gce-al.weebly.com/uploads/1/4/1/2/1412714/ch12-key_points.pdf
12.3 Program Testing and Maintenance
Show understanding of ways of exposing and
avoiding faults in programs

Locate and identify the different types of errors:


o syntax errors
• ( an error in which a program statement does not follow the rules of the language.) Syntax errors are errors in the
grammar of the program language. That is, the rules of the language have been broken (Taken from
https://gceguide.cc/computer-science-9608-paper-2-theory-notes/)
o logic errors
Type of error: A logic error
Description:
An error in the algorithm / design of the solution
the program does not behave as expected / give the expected output.
Accept by example e.g. wrong arithmetic operator used / wrong loop
count
o run-time errors
The program executes an illegal instruction // performs an illegal operation that is trapped by the O.S.
After correcting all syntax errors, the pseudocode is translated into program code which compiles without
generating any errors.
When the program is executed it unexpectedly stops responding.
Identify the type of error that has occurred.
- Run-time

Correct identified errors


Each pseudocode statement in the following table may contain an error due to the incorrect use of the function or
operator.
Describe the error in each case, or write 'NO ERROR' if the statement contains no error.
You can assume that none of the variables referenced are of an incorrect type.

Show understanding of the methods of testing


available and select appropriate data for a given
method:
Including:

• dry run
The process of checking the execution of an algorithm or program by recording variable values in a trace table.
• walkthrough

(Taken from David Watson, and Hellen Williams textbook)

• white box

- White-box
In this method the internal structure design or implementation of the item being tested is known to the tester.
Tester validates the internal structure of the item under consideration along with the output. In short, white-box
testing is testing every path through the program code. In IDE setting breakpoints, stepping and subroutine
parameter checking are the features that provides to carry out white box testing. (Taken from
https://gceguide.cc/computer-science-9608-paper-2-theory-notes/)

• black box

In this method the internal structure design or implementation of the item being tested is not known to
the tester. Tester is mainly concerned with validation of output rather than how the output is produced.
In short, black-box testing is comparing expected value with actual results when program runs.
(Taken from https://gceguide.cc/computer-science-9608-paper-2-theory-notes/)
How data is chosen in black-box testing:
to test that the program does what it is supposed to do / to check that
the results are as expected
to use known valid, boundary and erroneous values

• integration
Modules that have already been tested individually
are combined into a single (sub) program which is then tested as a whole

• alpha
• This is the testing done on software 'in-house', meaning it is done by the developers
another term for 'first round of testing' (I took this definition from Znotes)

• beta
Testing carried out by a small group of (potential) users
Users will check that the website/software works as required / works in the real world //User will identify
errors in the website/software Users will feedback (problems) / suggestions for improvement
Problems / suggestions identified are addressed (before the program is sold)

• acceptance

• stub

Show understanding of the need for a test strategy


and test plan and their likely contents

Choose appropriate test data for a test plan:


Including
• Normal
that is to be accepted by a program and is used to show
that the program is working as expected. (Taken from David Watson, and Hellen Williams textbook)

• Abnormal
that should be rejected by a program as it is unsuitable
or could cause problems. (Taken from David Watson, and Hellen Williams textbook)

• Extreme
• that is on the limit of that accepted by a program; for
example, when testing a validation rule such as number >= 12 AND
number <= 32 the extreme test data would be 12 at the lower limit and
32 at the upper limit; both these values should be accepted. (Taken from David Watson, and Hellen Williams
textbook)

• Boundary
that is on the limit of that accepted by a program or
data that is just outside the limit of that rejected by a program;
for example, when testing a validation rule such as number >= 12 AND
number <= 32 the boundary test data would be 12 and 11 at the lower
limit and 32 and 33 at the upper limit; 12 and 32 should be accepted,
11 and 33 should be rejected. (Taken from David Watson, and Hellen Williams textbook)

Show understanding of the need for continuing


maintenance of a system and the differences
between each type of maintenance:
Including:
• Perfective
Testing is completed, and the program is made available to users. Some time later, changes are made
to the program to improve the speed of response.
State the type of maintenance that has been applied to the program.
Perfective maintenance.

• Adaptive
State the term used for changes that are made to a program in response to a specification change.
- Adaptive maintenance

The hardware that runs the program is changed and the program needs to be modified so that it works
with the new hardware.
Identify the type of maintenance that this represents and give one other reason why this type of maintenance
may be needed:
Adaptive
Reason: The (user) requirements) changes // to accommodate legislative changes

• Corrective
changes to correct a bug / problem / error in the program

Analyse an existing program and make


amendments to enhance functionality

I.D.E:

• for initial error detection


• dynamic syntax checks
• - highlighting syntax errors
• for presentation, including
prettyprint
Colour code keywords so the user can identify any errors
expand and collapse code blocks
The user can hide code that they are not currently working on
• for debugging, including
single stepping
Run the code one line at a time // shows
the effect of each line of code

breakpoints
Stop the code running at a set point to check the flow/variable contents
i.e. variables, expressions, report
window

Library routines are beneficial because they are robust thus already tested and save programming
time. They can perform complex calculations which the programmer may not be able to perform.

You might also like