Professional Documents
Culture Documents
The Cambridge International AS & A Level Computer Science Teacher’s Resource will publish
later this summer.
We have produced this ‘Starter Pack’ to enable you to plan and teach the new course while
we finalise and print the new resource.
We are working closely with Cambridge Assessment International Education to provide
endorsed resources to support your students following the Cambridge Pathway to give you
confidence that they reflect the new syllabus.
This pack contains content from the teacher’s resource written to support the new syllabus
for examination from 2021.
It contains the following:
• Table of contents
• Introduction
• Chapter 1 and 2 from Part 1: Theory fundamentals and Chapter 12 and 13
from Part 2: Fundamental problem-solving and programming skills.
Please note that the material included in this Starter Pack is at an advanced draft stage but
may still change between now and publication. In addition, the content of the teacher’s
resource sample is a print version of a digital product and consequently may vary visually
from the actual resource.
Visit our website to view the full series or speak to your local sales representative. You can find
their contact details here:
cambridge.org/education/find-your-sales-consultant
Introduction
The syllabus has defined the following learning objectives relating to this topic:
show understanding of the basis of different number systems
describe practical applications where Binary Coded Decimal (BCD) and Hexadecimal are used
show understanding of binary magnitudes and the difference between binary prefixes and decimal prefixes.
The notes and guidance given in the syllabus provide details of the topic content relating to these learning
objectives. However, the order is not intended as a basis for teaching. The breakdown into topics here matches
the coursebook content and is suitable for a teaching programme.
Note that the use of binary prefixes for defining quantities is an entirely new topic for this syllabus so there are no
exam paper questions for the 9608 syllabus that relate to this. The binary prefixes are only defined for large
values so it is only necessary to consider the decimal prefixes for the comparable large values.
Teaching guidance
Introducing the topic
It would be useful to start a class discussion to get learners to think of all the different types of numbers with
which they are familiar. Finally, you could ask them to identify which types of number they are going to meet in
the syllabus, and where.
You could follow this by a PowerPoint slide presentation outlining the individual aspects to be covered in the
following lessons.
You can postpone an introduction to binary prefixes until the last lesson for this topic.
It is best to leave further assessment until the next topic has been studied.
Differentiation
Supporting learners
It is important to insist that learners who are struggling with conversions involving binary numbers always write
the binary digits in boxes. Each box should have a header that has the appropriate power expressed as 20, 21, for
example, or the corresponding denary value or possibly both. The aim is to ensure the correct number of digits
are used and also to reinforce learners’ familiarity with the denary equivalents of the powers of two.
You could ask learners to look at Worked Examples 1.01 and 1.02 in the coursebook and to answer Questions 1, 3
and 4 in Worksheet 1.1.
Language awareness
Learners sometimes confuse binary and denary. It is important to stress that denary and decimal are synonyms.
However, there are certain contexts where a particular one is chosen.
Further reading
http://courses.cs.vt.edu/~csonline/NumberSystems/Lessons/index.html
http://csunplugged.org/binary-numbers
https://physics.nist.gov/cuu/Units/binary.html
Introduction
The syllabus has defined the following learning objectives related to this topic:
show understanding of the basis of different number systems
perform binary addition and subtraction
describe practical applications where Binary Coded Decimal (BCD) and Hexadecimal are used.
As with the previous topic, the details of the syllabus content are not presented in an order that is meant to be
the order for teaching. Note that the syllabus refers only to positive or negative integers. There are a number of
points to note here:
You might wish to extend the teaching here to include fixed point binary real numbers, in order to cover the
fact that the mantissa for a floating-point representation of a number is a fixed point real value.
Sign and magnitude representation of a signed integer is not included in the syllabus. However, you will need
to refer to this in the context of converting a denary representation of a negative integer value into a two’s
complement binary representation.
Currency values are fixed point real numbers but cannot be stored and manipulated as real values because of
the inevitable approximation when a denary fraction is converted to a binary fraction. This problem
associated with real numbers is not explored in detail here. However, when explaining the use of BCD for
handling currency values you will need to give some explanation as to why this is done.
Binary addition and subtraction are an entirely new topic for this syllabus so there are no exam paper
questions for the 9608 syllabus that relate to this.
Teaching guidance
Introducing the topic
A PowerPoint presentation can be used that begins by emphasising two vital points:
There is a constraint on the storage of a value in a computer system caused by the limited number of bits
allowed
There is a need for a computer system to be able to carry out binary arithmetic effectively.
You could follow the PowerPoint for a definition of two’s complement and illustration of conversion from denary.
You could postpone introducing BCD and its applications until the last lesson for this topic.
Formative assessment covering this topic and the previous one would be appropriate. Tasks 1.01 to 1.04 from the
coursebook could be used along with Questions 1 to 5 from Worksheet 1.1.
Differentiation
Supporting learners
You can ask learners to look at Worked Example 1.03 in the coursebook and to answer Questions 2 and 5 in
Worksheet 1.1.
Challenging learners
You can encourage high achievers to research computer arithmetic, including computer arithmetic associated
with the use of BCD.
You could use the Discussion Point from the coursebook and Question 5 from Worksheet 1.1 as a basis for
reflecting on the underlying reasons for the use of two’s complement.
Learners should answer Question from Worksheet 1.2.
Topic 3: Text
Covering coursebook section 1.04 Internal coding of text
Introduction
The syllabus has defined the following learning objective related to this topic:
show understanding of, and be able to represent, character data in its internal binary form depending on the
character set used.
This topic requires learners to gain knowledge and understanding but you must reassure learners that no detailed
knowledge of the coding schemes is expected.
The ASCII concept is simple and straightforward and standardisation has occurred. However, learners need to be
made aware that the standard is not always followed. You might wish to schedule a lesson for introducing this
topic to immediately precede the introduction of programs using built-in functions for handling strings. These are
introduced in Section 13.06 of the coursebook.
Teaching guidance
Introducing the topic
A presentation discussing the origin of the character coding schemes is needed. This can include illustrations of
some of the ASCII codes. It can also describe how Unicode can simultaneously incorporate codes which have
different representations that might use one, two, three or four bytes.
Challenging learners
You could ask high achievers to carry out limited research into some of the Unicode schemes.
Question 2 in Worksheet 1.2 could be attempted.
Further reading
https://www.ascii-code.com/
https://www.webopedia.com/TERM/A/ASCII.html
http://unicode.org/
Topic 4: Multimedia
Covering coursebook sections 1.05 Images and 1.06 Sound
Introduction
The syllabus has defined the following learning objective related to this topic:
show understanding of how data for a bitmapped image are encoded
perform calculations to estimate the file size for a bitmap image
show understanding of the effects of changing elements of a bitmap image on the image quality and file size
show understanding of how data for a vector graphic are encoded
justify the use of a bitmap image or vector graphic for a given task
show understanding of how sound is represented and encoded
show understanding of the impact of changing the sampling rate and resolution.
Teaching guidance
Introducing the topic
There will be a need for presentations where learners are introduced to the concepts and the terminology
associated with these specialised areas. However, it might not be the best approach to use these as the first
introduction to the topic.
The following figure from the coursebook can be used in a presentation to explain sampling of sound.
This is a suitable opportunity for formative assessment. Exam-style Questions 2 and 3 from the coursebook could
be used along with Question 6 from Worksheet 1.1 and Question 3 from Worksheet 1.2.
Because this topic has so much specialised terminology it is a good opportunity to have an assessment using flash
cards. The key terms in the coursebook could be made into flash cards for you to hold up and ask learners to
write down the definition or call out the definition.
Differentiation
Supporting learners
You could ask learners to look at Worked Example 1.04 in the coursebook and to answer Question 6 in
Worksheet 1.1.
Challenging learners
Question 3 in Worksheet 1.2 should be answered.
Topic 5: Compression
Covering coursebook section 1.07 Compression techniques
Introduction
The syllabus has defined the following learning objective related to this topic:
show understanding of the need for, and examples of, the use of compression
show understanding of lossy and lossless compression and justify the use of a method in a given situation
show understanding of how a text file, bitmap image, vector graphic and sound file can be compressed.
There is no explicit reference to the compression automatically applied if a file is saved in a proprietary format or
to the compression used when files are zipped. The only technique identified is RLE. You will have to apply
judgement as to how many other techniques might interest your learners.
Teaching guidance
Introducing the topic
Learners need to gain knowledge and understanding of the principles of compression. It might be beneficial to
begin with a discussion about the need to use compression or the advantages of using compression. Encourage
your learners to relate any direct experience they have had in using compression. You could remind them that
saving a file to a specific file type can lead to compression being used without telling the user. This should lead up
to the crucial consideration of when it is beneficial or necessary to recover the original file from its compressed
form. This can then introduce the concepts of lossy and lossless compression. You could conclude by summarising
the main points.
Differentiation
Supporting learners
Question 7 in Worksheet 1.1 could be used.
Challenging learners
Question from Worksheet 1.2 should be answered.
Language awareness
Learners absolutely must use the terms ‘lossy’ or ‘lossless’. They should not use expressions such as ‘jpeg
compression’ or anything similar.
Further reading
http://computer.howstuffworks.com/file-compression2.htm
www.cs4fn.org/mathemagic/sonic.html
a The last row in the above table shows a binary code. Fill in the top two rows of the table, assuming that
the code represents a binary number.
b If this binary code represents an unsigned integer, is the denary equivalent an even or an odd number?
Explain your reason.
c If this binary code represents an unsigned integer, give the denary equivalent.
d If this binary code represents a two’s complement representation of a signed integer, does it represent a
negative or positive number? Explain your reason.
e Give the denary equivalent of this two’s complement representation.
4 If the denary number 373 is to be converted to a binary representation, how many bits will be needed?
Explain your reason.
5 A car has an odometer (measuring distance travelled in kilometres), which at the start of a journey shows
99940 and at the end shows 00230.
a Use common sense reasoning to find the distance travelled.
b Try calculating this by subtracting 99940 from 00230 using a calculator or spreadsheet.
What is the problem?
c Nine’s complement is defined as the number obtained by subtracting each digit from 9 and ten’s
complement is obtained by adding 1 to the nine’s complement. Show a calculation to get the correct
answer by converting the 99940 to its nine’s complement then to its ten’s complement and then adding
this to 00230.
b If the two numbers are added what is the total expressed as a denary value?
c If the two binary representations are added, ignoring the fact that they are BCD codes, what is the
result obtained?
d Show a correct calculation using the BCD values but applying the correction factor 0110.
e Why does this correction factor work?
f 9.75 can be represented exactly as a fixed-point binary value but 7.68 cannot. Why is this so?
2 Choose whether each of the following statements is true or false:
A In the early days of computing a printer could only print upper-case letters.
B To convert the ASCII code for an upper-case letter to the corresponding lower-case letter you have to
add 20.
C To convert the ASCII code for a lower-case letter to the corresponding upper-case letter you have to
add 20.
3 Choose whether each of the following statements is true or false:
A A picture element is an object in a vector graphic image.
B Colour depth refers to the intensity of the colour used to define an object in a vector graphic image.
C A drawing list is a list of the objects in a vector graphic image.
D The resolution of an image is the size of a pixel in a bitmapped image
4 The following table is a rearranged version of Table 1.04 in the coursebook. It shows a possible set of Huffman
codes to be used for lossless compression of a text consisting only of the eight letters shown.
E T o h l p w z
The codes will have been chosen by using an algorithm that has as the input the frequencies of occurrence of
each of the letters in the particular text. The choice of codes can be represented as a Huffman tree. A partially
completed tree is shown below:
Topic 1: Networking
Covering coursebook sections 2.01 The evolution of the purpose and benefits of networking and 2.02 Network
topologies.
Introduction
Before considering this specific topic, it is worth emphasising two general points:
1 The syllabus content covered by the whole of this chapter is presented as an unstructured list of items. This
fragmentation is inevitable with networking embracing such a wide range of different aspects, each of which
is quite complex, and many items will be better understood when the A Level content is covered.
2 Networking is a practical activity involving the installation and management of hardware and software.
However, you as a teacher and any of your learners are unlikely to have any practical experience of
networking. You are likely to have used systems that are networked. Almost all of the subject matter will
therefore be experienced by your learners theoretically and not practically.
The syllabus has defined the following learning objectives related to this topic:
show understanding of the purpose of, and benefits of, networking devices
show understanding of the characteristics of a LAN (local area network) and a WAN (wide area network)
explain the client-server and peer-to-peer models of networked computers
show understanding of thin-client and thick-client and the differences between them
show understanding of the bus, star, mesh and hybrid topologies.
There is a major change in syllabus content from the 9608 syllabus, in that scripting has been omitted. This leaves
the client-server content more generalised. Another change is that network topologies are now here and not in
the A Level content as was the case previously. Ring topology has been removed. Hybrid technology is a new
feature.
Teaching guidance
Introducing the topic
You could introduce this topic by starting a class discussion to get learners to think of their experience of using
networks and their understanding of the technologies used.
You could follow this by a presentation outlining the individual aspects to be covered in the following lessons.
Further reading
https://www.studytonight.com/computer-networks/
Introduction
The syllabus has defined the following learning objectives related to this topic:
show understanding of the differences between and implications of the use of wireless and wired networks
describe the hardware that is used to support a LAN.
You might wish to briefly discuss Bluetooth because your learners are likely to be familiar with its use. However,
you should note that the syllabus only has explicit reference to WiFi. Hubs and gateways could be introduced
even though they are not explicitly mentioned in the syllabus.
Teaching guidance
Introducing the topic
A presentation would be appropriate to introduce transmission media. For learners lacking any prior knowledge
of electromagnetic waves, for example light, you could give some introductory coverage of how the spectrum is
divided into different types of electromagnetic wave, depending on frequency (or wavelength).
You could postpone a presentation regarding LAN hardware until the last lesson for this topic.
Differentiation
Supporting learners
You could ask learners to answer Questions 1 to 4 in Worksheet 2.1.
Challenging learners
Question 1 in Worksheet 2.2 can be attempted.
Further reading
http://ecomputernotes.com/computernetworkingnotes/communication-networks/describe-the-different-transmission-
media
https://www.technologyuk.net/telecommunications/networks/transmission-media.shtml
https://www.linux.com/learn/intro-to-linux/2017/10/linux-networking-hardware-beginners-lan-hardware
Topic 3: Ethernet
Covering coursebook section 2.05 Ethernet
Introduction
The syllabus has defined the following learning objective related to this topic:
show understanding of Ethernet and how collisions are detected and avoided.
Only a very limited knowledge of Ethernet is required at this stage. Protocols are properly introduced at A Level
stage.
Differentiation
Supporting learners
Question 6 in Worksheet 2.1 could be attempted.
Further reading
http://www.teach-ict.com/technology_explained/ethernet/ethernet.html
https://www.lifewire.com/what-is-ethernet-3426740
Topic 4: Internet
Covering coursebook sections 2.06 The Internet infrastructure and 2.07 Applications that make use of the
Internet
Introduction
The syllabus has defined the following learning objective related to this topic:
describe the hardware that is used to support the Internet
describe the role and function of a router in a network
show understanding of the differences between the World Wide Web (WWW) and the Internet
show understanding of cloud computing
show understanding of bit streaming.
The major concepts associated with the Internet are TCP/IP, layered protocol suites and packet switching. Since
all of these are only formally introduced in the A Level syllabus content, the learning experience here has to be
carefully planned. The coursebook chapter does use the term ‘protocol’ in a few places but usually with a
disclaimer that its exact meaning is not important at this stage. You might decide that a little clarification here
would be beneficial.
Cloud computing is an entirely new topic for this syllabus so there are no exam paper questions for the 9608
syllabus that relate to this.
The final topic in this chapter will introduce some detailed content relating to one small aspect of networking. For
this reason the current stage is a suitable opportunity for formative assessment of what has been studied so far.
You could use Exam-style Questions 1 and 3 from the coursebook and Question 7 from Worksheet 2.1.
Differentiation
Supporting learners
Learners could attempt Question 6 in Worksheet 2.1.
Language awareness
The terms ‘the Internet’ or ‘the web’ are often treated as synonyms. Learners need to develop a rigorous
approach to their use of language.
Further reading
http://web.stanford.edu/class/msande91si/www-spr04/readings/week1/Howstuffworks.htm
https://computer.howstuffworks.com/internet/basics/internet-infrastructure.htm
https://computer.howstuffworks.com/cloud-computing/cloud-computing.htm
Topic 5: Addressing
Covering coursebook section 2.08 IP addressing and 2.09 Domain names
Introduction
The syllabus has defined the following learning objective related to this topic:
explain the use of IP addresses in the transmission of data over the Internet
explain how a Uniform Resource Locator (URL) is used to locate a resource on the WWW, and the role of the
Domain Name Service (DNS).
The syllabus has retained the structure of the content from the 9608 syllabus with IP addressing introduced here
in the AS syllabus before IP has been fully introduced as part of the A Level content. This allows the learning
programme to be limited to just a few topics.
The content has two new items specifically identified: sub-netting and static and dynamic IP addressing. In
addition, IPv6 is now specifically identified alongside IPv4. The reference to IPv6 is in a guidance sentence about
the format of an address. The remainder of the learning can focus on the use of IPv4.
Teaching guidance
Introducing the topic
You have an option here. Because your learners will be familiar with using URLs and email addresses you might
choose to begin with a discussion of domain names and the domain name system. You could then consider the
underlying addressing system. The alternative is to start with the IP address system and then move on to the
user-friendly domain name system. Whichever approach is used, there is a need for learners to become familiar
with a considerable body of facts and concepts. In addition, they need to understand the reasons for the
decisions that have been made with respect to Internet usage. Learners could initially be asked to carry out their
own research. However, there will be a need for a presentation to ensure that all relevant aspects have been
considered and understood.
You could use questions 2, 4, 5 and 6 from the Exam-style Questions in the coursebook for formative assessment.
Differentiation
Supporting learners
Questions 7, 8 and 9 in Worksheet 2.1 could be answered.
The IP address topic is an opportunity to check that binary and hexadecimal representations are well understood.
Challenging learners
You should give learners question 2 from Worksheet 2.2.
Further reading
https://www.uswitch.com/broadband/guides/what_is_an_ip_address/
http://www.build-your-website.co.uk/understanding-domain-names/
It is suggested that Chapter 12 is worked through in parallel with Chapter 14 (Sections 14.1 to 14.13).
Teaching guidance
Introducing the topic
You could have an introductory session that is a discussion or internet search about what the learners think
computational thinking is and why it is important.
Here is a link to a guide for teachers:
https://www.computingatschool.org.uk/computationalthinking
The Computing At School website has many other resources that teachers might find useful.
Teaching guidance
Introducing the topic
It is important that learners understand the concept of an algorithm and that algorithms are not just used as a
step towards programming. Let learners think of other types of algorithms they have come across: knitting
patterns, steps in origami (paper folding), assembly instructions for a computer hardware system. Emphasise how
important it is that the steps are detailed enough to be followed successfully and that the steps are in the
correct order.
Teaching guidance
Introducing the topic
It is very important that learners understand that the concept of a variable in computer science algorithms (and
programs) is different to the concept of a variable in mathematics. A simple way to visualise a variable in the
computer science context is to imagine computer memory consisting of a series of boxes. Each box can contain a
single value. If we want to use a value in one of these boxes, we refer to the name of the box.
Introduction
The syllabus allows a choice between the following programming languages: Python, Visual Basic and Java.
The practical skills for Paper 4 build on the practical skills covered in Paper 2. It is therefore recommended that
learners choose the same high-level programming language for this paper as they do for Paper 2. This will give
learners the opportunity for extensive practice and allow them to acquire sufficient expertise.
Note that if Visual Basic is chosen, only VB.NET is appropriate for Paper 4 as this is the earliest version that
provides object-oriented programming features. VB6 and older versions are not appropriate.
Whether you decide to teach your learners Python, VB or Java might depend on your own expertise. It is
important that you are able to trouble-shoot learners’ programs when they get stuck and need help to find an
error (whether it is a syntax, a logic or a run-time error).
If you are new to programming yourself, you might wish to go for the newest language (Python 3). It is very easy
to install and currently very popular. Whichever language you choose, there are lots of websites for tutorials and
extra exercises (see the Scheme of Work for links).
Exercise 12.04
For your chosen language, type in the code as displayed in the table. Use the comments in the table to explain the
resulting messages.
Python
1. EOL while
scanning
string literal
(quotes must
Figure 12.01 match)
The Prettyprint shows keywords and strings. There might be other syntax errors 2. Invalid syntax
that are reported one at a time when trying to run the module. highlighting
the second
quote on the
print line
(print
parameter
needs to be in
brackets)
3. Invalid syntax,
highlighting
yourName
VB.NET
1. Underlined
variable name
because it is
not declared
2. Console.write
(bracket
underlined
with message
expression
Figure 12.02 expected)
The Prettyprint functionality helps the programmer to spot syntax errors. If auto- because
indent does not work, this suggests an error. double quotes
Auto-complete minimises misspelt keywords. required in VB
Errors are underlined and hovering the mouse pointer over the error shows 3. When
an explanation. running, the
name is not
output in the
message. This
is not because
the variable
name is not in
CamelCaps
(VB is not
case-sensitive)
but because a
comma is used
to separate
the print list
items. In VB,
use an &
Teaching guidance
Introducing the topic
At this point only introduce the simple data types: integer, real, char, string and Boolean.
Learners will already have used the string data type in Task 14.01. When you went through Worked Example
12.01 you would have used the integer and real data types. The next topic builds on the concept of
Boolean values.
Remind learners that some languages require variables to be declared before use (VB.NET and Java) whilst other
languages (Python) do not.
Teaching guidance
Introducing the topic
Learners sometimes have difficulty with more complex logic statements or changing from AND to OR.
Explain that:
For NOT(A AND B) to be TRUE is the same as for (NOT A) OR (NOT B) to be true. You might wish to show this using
a truth table:
This will be very important later on, when a post-condition loop might need changing to a pre-condition loop.
Teaching guidance
Introducing the topic
Introduce the CASE statement as an alternative to nested IF statements. Learners should avoid using nested IF
statements when CASE statements are more appropriate. Python programmers need to use the IF ELIF
construct instead.
Give learners the syntax for the CASE statement.
Topic 8: Iteration
Covering coursebook sections 12.07 Loops and 14.06 Iteration
Teaching guidance
Introducing the topic
Learners sometimes find the concept of iteration difficult. Introducing trace tables (See coursebook Section 15.06)
and variable watch windows in a debugger can help learners to visualise what happens and help them
understand.
Teaching guidance
Introducing the topic
Remind learners that the ASCII and CHAR functions reinforce the idea that strings are actually stored as a series of
(binary) numbers and that comparison of characters is the comparison of their (binary) codes. Consequently it is
possible to perform a comparison between ‘2’ and ‘a’ and get a valid result.
Differentiation
Challenging learners
Ask learners to do Worksheet 12.1/14.1 Question 18.
Teaching guidance
Introducing the topic
After completing Worked Example 12.10 and Task 12.06, let learners tackle each of the following exercises. For
each exercise, learners should return to the pseudocode from the previous exercise. They should amend the
pseudocode before changing their program to solve the enhanced problem.
Exercise 12.07
Ask learners to enhance the word-guessing game. Instead of Player A choosing a secret word, the program
generates a random number and uses this number to read a word from a text file of words.
Introduce two players taking turns to guess the word.
Go through Worked Example 12.11. Ask learners to do Task 12.07.
Go through how to declare procedures in the chosen programming language using the example in Section 14.09.
Ask learners to do Task 14.10.
Exercise 12.08
You could ask learners to make some of their earlier programs into modules with a menu to let the user choose
which program to run. For example, a Module ‘Show Menu’ could produce the following prompt:
1 Convert from km to miles
2 Convert inches into cm
3 Number guessing game
Differentiation
Challenging learners
Exercise 12.09
Change the word-guessing game for one player by asking the player to guess just a single letter. If the letter does
not exist in the secret word, the player increases their penalty score. The program should show a symbol for each
letter of the word and when a letter has been guessed, this is shown. For example, if the secret word is
COMPUTER and the player has guessed the letter P, the program outputs ###P####. The game continues until the
word has been guessed. The output is the penalty score. Remove the limit on the number of guesses.
Teaching guidance
Introducing the topic
Remind learners that they have met parameters already when using built-in functions (Topic 9). For example, the
function header of the pseudocode function:
LENGTH(ThisString : STRING) RETURNS INTEGER
shows that this function takes one parameter of data type STRING. The identifier ThisString is known as a
formal parameter. It will be replaced by the actual parameter when the function is called. Similarly, procedure
headers can have a parameter list with one or more parameters and the formal parameter(s) will get replaced by
actual parameters when the procedure is called.
Note: For ease of understanding, examples in the exercises use the same identifiers for formal and actual
parameters, but this is not a requirement.
Pseudocode
Get learners to work out what the output will be for each of the three programs. Then use the example code
for the programming language of your choice. Produce a handout with the relevant code. Let learners check
whether they predicted the output correctly.
Program Scope1 uses global variables throughout.
Program Scope2 uses local variables but no parameters.
Program Scope3 uses local variables in PROCEDURE C and parameters for PROCEDURE A and PROCEDURE B.
Note the difference between value and reference parameters.
PROGRAM Scope1 PROGRAM Scope2 PROGRAM Scope3
DECLARE X : INTEGER
DECLARE Y : INTEGER
OUTPUT X X 5
X 5
ENDPROCEDURE OUTPUT X
OUTPUT X
ENDPROCEDURE
ENDPROCEDURE
public static void a() public static void a() public static int a(int x)
{ { {
x = 5; int x = 5; x = 5;
public static void b() public static void b() public static void b
(int y)
{ { {
y = 7; int y = 7; y = 7;
Exercise 12.10
Encourage learners to produce a fully working program for the pyramid-drawing task.
Supporting learners
You could encourage learners who find this difficult to have a look at the detail in Section 14.14.
It is suggested that Chapter 13 is worked through in parallel with Chapter 14 (Sections 14.14 and 14.15).
Further reading
An excellent facility for demonstrating different sorting algorithms can be found at:
http://www.sorting-algorithms.com/
Very good notes and diagrams for abstract data types can be found at:
http://www.teach-ict.com/as_as_computing/ocr/H447/F453/3_3_5/data_structures/miniweb/index.htm
Teaching guidance
Introducing the topic
Some learners might find declaring a user-defined type difficult. The concept of a record type could be compared
to designing a form to collect data about a particular person, thing or event. The dot notation might need more
explanation: the identifier before the dot is the person/thing/event. The identifier after the dot is the field (the
label of the box if it is a paper form to be filled in).
Here are some examples for ‘forms’:
Forms to enter data about job vacancies (job title, company, hourly rate of pay, hours)
Forms to enter data about events held at a public venue (date, event title, ticket price, duration in hours)
Forms to enter data about goods stocked in a shop (item description, item code, price, number of items in stock).
Exercise 13.01
Ask learners to design a form for data to be held about one of the above examples. The boxes for the information
to be entered should have concise labels. Using pseudocode, they need to declare a record type with fields to
store the data. Then they should decide on some example data for one or two items. Using pseudocode, ask them
to write variable declarations and assignment statements for these fields.
Exercise 13.02
Ask learners to use their programming language to write programming statements from the pseudocode
generated in Exercise 13.01. Output statements should be added to ensure the data is stored correctly.
Topic 2: Arrays
Covering coursebook sections 13.03 Arrays, 13.04 One-dimensional arrays, and 14.14 Arrays
Teaching guidance
Introducing the topic
Introduce the concept of an array structure using Worked Example 13.01.
Explain the pseudocode syntax for declaring and using an array. Ask learners to do Task 13.03.
Now explain the syntax for arrays in the chosen programming language.
Differentiation
Challenging learners
Ask learners to do Task 13.07.
Teaching guidance
Introducing the topic: Searching
Introduce the concepts of linear search and how the algorithm can be efficiently designed when using a 1D array
and a loop.
Go through Worked Example 13.02.
Exercise 13.04
Ask learners to write their own programs from the most efficient bubble-sort algorithm and test their programs.
This is a good example of where a variable watch could be used to check that the program is sorting or
searching correctly.
Differentiation
Challenging learners
Exercise 13.05
You can encourage learners to write programs for each of the bubble sort algorithms shown in Worked Example
13.03 and include output statements at the beginning of each loop to trace the progress of each algorithm. Then
different data sets can be used to demonstrate how the two algorithms behave.
Let learners summarise the essential characteristics of the bubble sort and linear search algorithms:
Bubble sort
Starting at the top of the list, work down the list comparing adjacent items, swapping them if they are in the
wrong order. This is done repeatedly. With each iteration of the outer loop the next largest item moves into its
final position. For efficiency there is one item fewer in the comparison each time round the outer loop. If no
swaps have been made during one whole iteration of the outer loop, the list is sorted.
Linear search
Start at the beginning of the list. Compare each item until the wanted item is found. This can be used on an unordered
list.
Ask learners to write program code for their solution to Exam-style Question 13.03.
Topic 4: 2D arrays
Covering coursebook sections 13.03 Arrays, 13.05 Two-dimensional arrays, and 14.14 Arrays
Teaching guidance
Introducing the topic
Introduce pseudocode syntax for 2D arrays.
Go through Worked Example 13.04.
Introduce programming language syntax for 2D arrays.
Differentiation
Challenging learners
Ask learners to do Task 14.14 part 2.
You could ask learners to write program code for Task 13.06, Worksheet 13.1/14.1 Questions 4 and 5.
Teaching guidance
Learners often find file handling quite difficult. Lots of practice is required! Although in the Paper 2 exam learners
will be required to use the pseudocode statements for file handling solutions, real understanding will be easier to
develop if learners have practical experience of programming file handling. Opening a file in a text editor to check
that their program has successfully written to the file is an important learning process.
Differentiation
Challenging learners
Ask learners to do Worksheet 13.2/14.2 Question 1.
Teaching guidance
Introducing the topic
For Paper 2, learners are not required to write pseudocode for these structures, but they should be able to add,
edit and delete data from these structures.
The diagrams in the coursebook show a stack with the first element at the bottom of a vertically drawn set of
boxes. To ensure learners are able to adjust pointer(s) correctly when pushing a data item onto a stack or popping
a data item off a stack, diagrams could be presented in different orientations, such as a stack with boxes drawn
across the page or the base of the stack as the first element in a vertical set of boxes.
Teaching guidance
Introducing the topic
It is very important that learners understand the concept of a linked list. It might help to have lots of cards that
look like nodes in the diagrams in the coursebook, with data items on them. Learners find it easier to order
numeric data, rather than alphabetical data, so some random numbers on the cards would be good.
Get learners to use pieces of string to represent pointers.
Exercise 13.06
You could ask learners to practise adding nodes in the correct place to the linked list.
The position of the nodes should not change, only the way they are connected using the ‘string pointers’.
Ask learners how an empty list might be represented.
You can then encourage learners to derive algorithms for the following cases:
1 adding an item to an empty list
2 adding an item to the beginning of a non-empty list
3 adding an item to the end of a non-empty list
4 adding an item within a non-empty list
5 removing the only item from a list
6 removing an item from the end of a list with more than one item
7 removing an item from the beginning of a list with more than one item
8 removing an item from within a list with more than two items.
Exercise 13.07
Discuss with learners how a stack is a special type of linked list. Which of the cases 1 to 8 are not required if the
linked list is to be used like a stack?
Exercise 13.08
Discuss with learners how a queue is a special type of linked list. Which of the cases 1 to 8 are not required if the
linked list is to be used like a queue?
256 128 64 32 16 8 4 2 1
0 0 1 1 0 0 0 0 0
For 96
6 0
1 1 0 1 0 1 1 1
For 215
D 7
1 0 1 1 1 0 1 1 0
For 374
1 7 6
For 96 learners might recognise that 96 is 6 x 16 and so the conversion to the hexadecimal 60 can be done
immediately.
The slow but steady route can be illustrated for the conversion of 374. The initial conversion to binary uses
successive division by two, noting the remainder each time and then reversing the remainders.
The remainders are 0 1 1 0 1 1 1 0 1 which in reverse give the binary as: 101110110. For conversion to
hexadecimal, groupings of four bits are converted starting at the least significant (RH) end. The 0110 converts to
6, the 0111 to 7 so the hexadecimal representation is 176.
The more advanced students might use a short cut. Noting that 374 is greater than 162 a three-digit hexadecimal
representation is expected. Calculating 374 – 256 leaves 118. This can be seen to consist of 7 16s with 6
remaining, hence 176.
Hexadecimal B4 becomes denary 180
Hexadecimal FF becomes denary 255
128 64 32 16 8 4 2 1
For B4 B 4
1 0 1 1 0 1 0 0
For FF F F
1 1 1 1 1 1 1 1
Question 1.01
Internally never: hexadecimal numbers are primarily used for representation of binary codes for a person to read.
A computer can, therefore, create hexadecimal representations for output. Alternatively, they could possibly be
used for input provided that they were to be converted immediately to binary.
Task 1.02
Table 1.08 in the coursebook shows the binary value for -7 to be 1001. (You could note that there could have
been any number of leading bits set to 1 without the conversion being affected other than to produce leading
zeros in the final answer). Using the method of retaining the least significant bit and switching the others gives
0111 which is +7.
Task 1.03
1011 = -23 + 21 + 20 = -8 + 2 + 1 = -5
111011 = -25 + 24 + 23 + 21 + 20 = -32 + 16 + 8 + 2 + 1 = -5
Question 1.02
6 bits only allows 64 codes. Including both upper case and lower case letters would use up 52 of these. Thus, only
upper case letters were coded.
Task 1.05
Suitable examples would be:
Circle, centre coordinates, radius, outline colour, outline style, fill colour.
Rectangle, coordinates of the bottom left corner, coordinates of bottom right corner, length, outline colour,
outline style, fill colour.
Exam-style Questions
(with mark allocation in brackets):
1 a i 38 195 from 215 + 212 and so on (1 + 1)
ii 9533 from 4-bit groupings (1 + 1)
b Any example involving presentation of a hexadecimal representation of a binary code to make it easier for
someone to read (1).
c i 10010101 because the most significant LHS bit is 1 (1).
ii -107 from -27 + 24 and so on and 51 from 25 + 24 and so on (1 + 1).
d Only one representation of zero. Allows simple computation for addition and subtraction. (1 + 1)
e Many options here, some possibilities (1 each, max 3) are:
BCD values either two per byte or just one per byte using just four bits
Two ASCII characters either using seven bits from each byte or using the full byte including a parity bit
One Unicode character using the two bytes
0 1 1 1 0 1 1 0 1 0 0 0
Because a currency value only has two digits to represent the fractional part, these two numbers in BCD
can occupy one byte. The implied decimal point is between this byte and the byte representing the whole
number value.
There are several points to note. With just two bytes the range of possible values is very small. In any real
system, there would be an agreed number of bytes to represent a value, always with just one byte
representing the fractional part. The use of the term ‘decimal point’ is valid here because BCD is a
character code for the decimal digits 0 – 9. The term ‘binary point’ should be used only when the
representation is of a binary number value.
b 17.43
c
1 0 0 1 0 1 1 1 0 1 0 1
+ 0 1 1 1 0 1 1 0 1 0 0 0
= 1 0 0 0 0 1 1 0 1 1 1 0 1
When you add the fractional parts, the result is a sequence of binary digits that is not recognisable as a
BCD value.
The addition of the whole number parts has suffered overflow.
d
0 1 0 1
+ 1 0 0 0
= 1 1 0 1
+ 0 1 1 0
= 1 0 0 1 1
+ 1 1 0 1
+ 0 1 1 0
= 1 0 1 0 0
+ 1 0 0 0 0
+ 0 1 1 0
= 0 0 0 1 0 1 1 1
Note how the calculation starts with the codes for the second decimal place BCD values then moves on
successively through the higher value BCD codes. At each stage, the initial result has 0110 added to it. At
each stage after the first one, any carry digit is included in the calculation. The final answer shows the
four BCD codes correctly representing the value 17.43.
However, note that the correction factor is used only when an individual addition has produced either an
unrecognisable non-BCD character or there has been an overflow. In the example above, it had to be
used three times.
e Four bits provide 16 distinct combinations. Six of these are not BCD codes; only codes 0000 to 1001 are
needed to represent decimal digits. Because 0110 is binary for decimal 6, this, used as a correction factor,
c No. To understand why, it is necessary to consider the implication of the prefix property. For two binary
digits, there are four combinations. Here 10 and 01 have been used to represent letters; 00 and 11 have
been carried forward to form part of three-digit codes. For three digits there are eight combinations but
four of these cannot be used to code letters because they begin with 01 or 10. In this scheme 110 and
111 have been used to code letters; 000 and 001 have been carried forward for four-digit codes.
Crucially, the scheme uses 0000, 0001, 0010 and 0011 to code letters leaving none to be carried forward.
Another way of seeing this is to look at the tree and note that the lowest level has no free spaces.
d The scheme should use two of the four codes with four digits to code letters. The remaining two four-
digit codes can be used to provide four distinct five-digit codes. Two of the original four-digit codes have
been lost but four new five-digit codes have been created so overall, two more letters are coded.
Task 2.01
Distance to travel is 15000 km
Speed of light is approximately 3 x 108 m s-1
Time taken = distance divided by speed:
15000 km divided by 300000 km s-1 = 0.05 s
Question 2.02
This is not a question with a fixed answer.
Task 2.02
Best approach probably to work in KiB units. The number of bits leaving the buffer in two seconds at 300 Kbps is
300 x 1000 x 2. In KiB this is (300 x 1000 x 2)/(1024 x 8). A similar calculation using 1 000 000 instead of 300 gives
the number of KiB entering the buffer in two seconds. The amounts for different times are just simple multiples of
these values. The difference between inflow and outflow gives net gain. This allows a rough estimate of the time
taken to fill to be made. This in turn allows a rough estimate of the time to empty to be made. Exact values need
algebra but there is no need to insist on an exact answer.
Exam-style Questions
(with mark allocation in brackets):
1 a i Twisted pair, coaxial or fibre optic NOT copper. (1 for an example, 2 for all)
ii Bandwidth, which defines the rate of data transfer. Attenuation, which defines how much the signal
degrades over time. Interference, which is how much the signal might be affected by external factors.
(1 per factor + 1 per explanation, max 4)
b i Might be answered by choosing from radio, microwave or infrared. Radio can penetrate walls, infrared
has the best bandwidth are two possibilities. Alternatively, might argue that within a room or a
building wireless is sensible. (1 + 1 for explanation)
ii No infrastructure needed, no drilling holes in walls or digging tunnels underground. (1)
iii If wireless is used outside a building it can be affected by weather conditions. Not guided. More
interference likely. (1)
c i Public switched telephone network, POTS, or provides telephone connections. (1)
ii Could provide dial-up connection through a modem to allow data transfer (1). Could provide a leased
line dedicated data connection (1). These would allow connections between buildings on the site (1).
Alternatively could provide access points for WiFi set up in individual rooms or buildings (1). Note that
the three marks for this question require some detail in the explanation. Should explain that
connections between buildings could involve PSTN support. (Max 3)
2 a i Database (1), server (1)
ii Any application that involves a website accessible via a URL that includes a domain name. Email using
an email address that includes a domain name. (1 for each name + 1 for each description, max 4)
b i Dotted decimal (1). Each byte in the 32-bit address is given its denary equivalent value (1).
ii Class C (1) because the top three bits are 110 when denary 205 is converted to binary (1).
iii Addressing is hierarchical (1). NetID is used for navigation through the Internet (1). Once the
communication reaches the network the hostID is used to locate the exact destination (1).
NC NS
2
So SF CF 2
Using the value 6375 km for the radius of the Earth, the calculations are:
For LEO the distance to the furthest point accessible ≈ 3708 km and the time taken is ≈ 12 ms.
For GEO the distance to the furthest point accessible ≈ 41676 km and the time taken is ≈ 139 ms.
Considering that a typical processor speed is at least 1 GHz, giving a clock cycle of less than a billionth of a
second, the times for satellite communications in milliseconds are very significant. The differences in
these times depending on the position on the Earth’s surface are also very significant but less so for GEO
because the extreme distance to the satellite dominates the time taken.
2 a Sub-netting uses a coding scheme for the hostID – which for a class C IP address uses eight bits.
To represent 30 workstations in a LAN, five bits will be needed because this allows 32 different codes.
There are three bits left to identify the LAN, so eight LANs can be created. If only 14 workstations are to
be connected in one LAN, only four bits are needed to represent them with individual codes.
This leaves four bits to identify LANs so 16 can be created.
b
Note that only the byte representing the hostID part of the IP address is shown for each workstation. In
each byte the two least significant bits are used to identify the workstation and the next two are used to
identify the LAN. The four most significant bits are unused so could be set to any value.
Task 12.01
Task 12.02
The following are examples of answers. These examples show the sort of detail students should show in their
answers.
Task 12.04
IF Age < 12 OR Age > 60 THEN fare is free
Question 12.01
The Greater Than signs (>) have to be replaced by Smaller Than signs (<):
IF Number1 < Number2
THEN // Number1 is smaller
IF Number1 < Number3
THEN
OUTPUT Number1
ELSE
OUTPUT Number3
ENDIF
ELSE // Number2 is smaller
IF Number2 < Number3
THEN
OUTPUT Number2
ELSE
OUTPUT Number3
ENDIF
ENDIF
Question 12.02
First part
The logic statement for Until has to be changed:
INPUT BiggestSoFar
Counter 1
REPEAT
INPUT NextNumber
Counter Counter + 1
IF NextNumber > BiggestSoFar
THEN
BiggestSoFar NextNumber
Second part
An extra input is required and again the logic statement for Until has to be changed:
INPUT MaxNumbers
INPUT BiggestSoFar
Counter 1
REPEAT
INPUT NextNumber
Counter Counter + 1
IF NextNumber > BiggestSoFar
THEN
BiggestSoFar NextNumber
ENDIF
UNTIL Counter = MaxNumbers
OUTPUT BiggestSoFar
Task 12.05
If it is not known how many times the loop will need to be executed, a REPEAT loop (or a WHILE loop) is more
appropriate. To be able to calculate the average, a count needs to be kept of how many numbers have been
added together. Note that using a REPEAT loop the rogue value is counted as a number, so calculating the
average needs to use (Count – 1)
Using a REPEAT loop:
RunningTotal 0
Count 0
REPEAT
INPUT NextNumber
RunningTotal RunningTotal + NextNumber
Count Count + 1
UNTIL NextNumber = 0
OUTPUT RunningTotal
Average RunningTotal / (Count – 1)
OUTPUT Average
Using a WHILE loop (note that rogue value is not counted as a number):
RunningTotal 0
Count 0
INPUT NextNumber
WHILE NextNumber <> 0 DO
Count Count + 1
RunningTotal RunningTotal + NextNumber
INPUT NextNumber
ENDWHILE
OUTPUT RunningTotal
Task 12.06
01 // Set up initial values
01.1 INPUT symbol
01.2 // Input Max Number Of Symbols
01.2.1 REPEAT
01.2.2 INPUT MaxNumberOfSymbols
01.2.3 UNTIL MaxNumberOfSymbols MOD 2 = 1
01.3 NumberOfLeadingSpaces (MaxNumberOfSymbols - 1) / 2
01.4 NumberOfSymbols 1
01.5 NumberOfMiddleSpaces -1
02 REPEAT
03 // Output number of leading spaces
03.1 FOR i 1 TO NumberOfLeadingSpaces
03.2 OUTPUT Space // without moving to next line
03.3 NEXT i
04 // Output symbol, middle spaces, symbol
04.01 IF NumberOfSymbols = 1 // top of pyramid
04.02 THEN
04.03 OUTPUT Symbol
04.04 ELSE
04.05 IF NumberOfSymbols < MaxNumberOfSymbols
04.06 THEN
04.07 OUTPUT Symbol
04.08 FOR i 1 TO NumberOfMiddleSpaces
04.09 OUTPUT Space // no new line
04.10 NEXT i
04.11 OUTPUT Symbol
04.12 ELSE // output the final line
04.13 FOR i 1 TO NumberOfSymbols
04.14 OUTPUT Symbol // no new line
04.15 NEXT i
04.16 ENDIF
04.17 ENDIF
04.18 OUTPUT Newline // move to next line
05 // Adjust values for next row
05.1 NumberOfLeadingSpaces NumberOfLeadingSpaces - 1
05.2 NumberOfMiddleSpaces NumberOfMiddleSpaces + 2
05.3 NumberOfSymbols NumberOfSymbols + 2
06 UNTIL NumberOfSymbols > MaxNumberOfSymbols
A better solution is to treat the tip and the base of the triangle separately and use the REPEAT loop for the other
lines.
PROCEDURE SetValues
INPUT symbol
// Input Max Number Of Symbols
REPEAT
INPUT MaxNumberOfSymbols
UNTIL MaxNumberOfSymbols MOD 2 = 1
NumberOfLeadingSpaces (MaxNumberOfSymbols - 1) / 2
NumberOfSymbols 1
NumberOfMiddleSpaces -1
ENDPROCEDURE
PROCEDURE OutputTopRow
CALL OutputLeadingSpaces
OUTPUT Symbol
OUTPUT Newline
ENDPROCEDURE
PROCEDURE AdjustValuesForNextRow
NumberOfLeadingSpaces NumberOfLeadingSpaces - 1
NumberOfMiddleSpaces NumberOfMiddleSpaces + 2
NumberOfSymbols NumberOfSymbols + 2
ENDPROCEDURE
PROCEDURE OutputLeadingSpaces
FOR i 1 TO NumberOfLeadingSpaces
OUTPUT Space // without moving to next line
NEXT i
ENDPROCEDURE
PROCEDURE OutputRow
OUTPUT Symbol
FOR i 1 TO NumberOfMiddleSpaces
OUTPUT Space // don’t move to next line
NEXT i
PROCEDURE OutputBaseRow
FOR i 1 TO NumberOfSymbols
OUTPUT Symbol
NEXT i
OUTPUT Newline
ENDPROCEDURE
Marking guidance:
1 mark for initialising Weighting and Total correctly
1 mark for correct loop structure
1 mark for correct input statement within loop
1 mark for correct assignment to Value within loop
1 mark for correct assignment to Total within loop
1 mark for correct updating of Weighting and Count
1 mark for correct assignment to Remainder
1 mark for correct assignment to CheckDigit
1 mark for correct IF statement structure and correct Boolean expression
Marking guidance:
1 mark for initialising Positive correctly
1 mark for initialising Negative correctly
1 mark for correct REPEAT loop structure and correct Boolean expression
1 mark for correct input statement within the loop
1 mark for correct IF THEN ELSE structure within loop
1 mark for correct Boolean expression
1 mark for correctly incrementing Positive and Negative
3
RogueValue -1
Total 0
Count 0
INPUT Number
WHILE Number <>RogueValue DO
Count Count + 1
Total Total + Number
INPUT Number
ENDWHILE
If Count > 0
THEN
Average Total / Count
OUTPUT Average
ENDIF
Marking guidance:
1 mark for initialising RogueValue
1 mark for initialising Total and Count correctly
1 mark for INPUT statement before loop
1 mark for correct loop structure and correct Boolean expression
Task 13.01
Identifier Explanation Data type
BiggestSoFar Stores the biggest number input so far INTEGER/REAL
NextNumber The next number to be input INTEGER/REAL
Stores how many numbers have been
Counter INTEGER
input so far
Task 13.02
1
TYPE BookType
Title : STRING
YearOfPublication : INTEGER
Price : REAL
ISBN : STRING
ENDTYPE
2
DECLARE Book : BookType
Book.YearOfPublication 2015
Book.Price 15.99
Book.ISBN "9781107546738"
Task 13.04
MaxIndex 19
INPUT SearchValue
Found FALSE
Index −1
REPEAT
Index Index + 1
IF Name[Index] = SearchValue
THEN
Found TRUE
ENDIF
UNTIL FOUND = TRUE OR Index >= MaxIndex
IF Found = TRUE
THEN
OUTPUT "Age:", Age[Index]
ELSE
OUTPUT "Name not found"
ENDIF
Task 13.05
n MaxIndex – 1
REPEAT
NoMoreSwaps TRUE
FOR j 0 TO n
IF MyList[j] < MyList[j + 1]
THEN
Temp MyList[j]
MyList[j] MyList[j + 1]
Task 13.06
1
DECLARE Board : ARRAY[1..3, 1..3] OF CHAR
2
CONSTANT Space = ' '
DECLARE Row, Column : INTEGER
FOR Row 1 TO 3
FOR Column 1 TO 3
Board[Row, Column] Space
NEXT Column
NEXT Row
3
Board[1, 1] 'A'
4
Board[2, 2] 'B'
Task 13.07
DECLARE BookArray : ARRAY[1..200] OF BookType
Book[1].YearOfPublication 2015
Book[1].Price 15.99
Book[1].ISBN "9781107546738"
Task 13.08
1
OPENFILE "GameData.txt" FOR WRITE
FOR Row 1 TO 3
FOR Column 1 TO 3
WRITEFILE "GameData.txt", Board[Row, Column]
NEXT Column
NEXT Row
Task 13.09
1
Task 13.10
1
Task 13.11
Exam-style Questions
1
Variable Example value Data type
ColourCode “034AB45” STRING
ProductionDate 2018/03/31 DATE
Weight 67.45 REAL
NumberInStock 98 INTEGER
SizeCode ‘X’ CHAR
Completed FALSE BOOLEAN
Marking guidance:
1 mark for each 2 correct entries in the data type column
Marking guidance:
1 mark for each correct column
3 a
Identifier Data type Explanation
Marking guidance:
1 mark for each 2 correct data types
1 mark for correct identifier PasswordList
1 mark for each correct cell completed in Explanation column
b
MaxIndex ← 20
INPUT MyUserID
INPUT MyPassword
UserIdFound ← FALSE
LoginOK ← FALSE
Index ← −1
Marking guidance:
1 mark for each correctly completed gap (shown by dotted lines)
c i
TYPE UserRecord
UserID : STRING
Password : STRING
ENDTYPE
Marking guidance:
1 mark for correct TYPE statement structure
1 mark for 2 fields correctly declared
ii
DECLARE User : ARRAY[0..20] OF UserRecord
Marking guidance:
1 mark for correct array declaration structure (i.e. DECLARE User : ARRAY[0..20])
1 mark for correct giving data type (i.e. OF UserRecord)