Specification point 1.2.3

Software Development

Exam questions: 14 questions, 116 marks

Question 1

6 marks

1 6 marks

The pseudocode algorithm here will take in two numbers from the user, multiply them together using addition and output the result. For example, 4 multiplied by 3 would be 4 + 4 + 4 = 12.

You can assume the function input takes in a value as an integer.

numA = input("Enter first number")
numB = input("Enter second number")

answer = 0

while (numB > 0)
 answer = answer + numA
 numB = numB - 1
endwhile

print(answer)

Write this algorithm in assembly language using the Little Man Computer (LMC) instruction set.

Mark scheme 1

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

  • INP and STA two numbers correctly

  • Appropriate use of branching to exit the loop.

  • SUB ONE and STA NUM

  • LDA ANSWER and ADD NUMA

  • Output (correct) answer.

  • Set DAT for NUMA, NUMB, ONE, ANSWER after HLT

POSSIBLE SOLUTION:

INP
STA NUMA INP
STA NUMB LOOPSTART LDA NUMB
BRZ LOOPEND SUB ONE STA NUMB LDA ANSWER ADD NUMA STA ANSWER BRA LOOPSTART

LOOPEND LDA ANSWER
OUT
HLT
ANSWER D AT 0 ONE DAT 1 NUMA DAT 0 NUMB DAT 0

Guidance

First and second number can be interchanged Accept suitable labels for DAT and Loop points For point 6 the 0s for ANSWER, NUMA, NUMB are optional but ONE must be initialised to 1.

Allow FT for BP5 if logic is correct.

Accept alternative mnemonics identified in the specification.

Examiner’s Comments

Most candidates were given some of the available marks for this question. Most were able to take two inputs and perform the addition of two numbers, storing the result in the accumulator. Candidates that lost marks did not successfully loop through the instructions correctly, didn’t output the correct answer and/or did not make use of DAT to subtract a value correctly.

out of 6

Question 2

5 marks

2 5 marks

A program stores data in a linked list.

The current contents of the linked list are shown in Fig. 3, along with the linked list pointers.

[Diagram redrawn from the original paper by an AI model (Gemma 4 12B). It may contain mistakes.]

headPointer1
freeListPointer4
locationdatapointer
0"blue"6
1"red"0
2"green"8
3"orange"NULL
45
57
6"grey"2
79
8"purple"3
9NULL

Fig. 3

The function findNode will search the linked list and return either the position of the node that contains the data item, or -1 if the data item is not found.

The data held in a node at location x can be accessed with linkedList[x].data. The pointer of the node at location x can be accessed with linkedList[x].pointer.

For example, using the linked list shown in Fig. 3:
linkedList[2].data returns green.
linkedList[2].pointer returns 8.

Complete the function, using pseudocode or program code.

function findNode(toFind, headPointer, linkedList)

  currentNode = ……

  while(currentNode != ……)

    if linkedList[currentNode]. …… == toFind then

      return currentNode

    else

      currentNode = linkedList[……].pointer

    endif

endwhile

return ……

endfunction
Mark scheme 2

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

1 mark for each statement

function findNode(toFind, headPointer,
linkedList)
  currentNode = headPointer
  while(currentNode != NULL)
    if linkedList[currentNode].data == toFind
then
      return currentNode
    else
      currentNode =
linkedList[currentNode].pointer
    endif
  endwhile
  return -1
endfunction

Guidance

Ignore case of identifiers in pseudocode

Only penalise excessive spaces within identifier names if obvious.

Examiner’s Comments

This question required exact answers only. Many candidates gained some marks, and there was a good distribution of marks. More successful programmers tended to get most of the marks available.

out of 5

Question 3

6 marks

3(a) 1 mark

A doCheck() function takes an integer value as a parameter, carries out a series of calculations and returns an integer value.

The function is shown here.

function doCheck(number)
  temp = str(number)
  max = temp.length – 1
  total = 0
  for x = 0 to max
    total = total + int(temp.subString(x,1))
  next x
  return total MOD 10
endfunction

State the value returned from the function when doCheck(3178) is called.

Mark scheme 3(a)
  • 9

Guidance

Examiner’s Comments

This was a relatively simple algorithm question which candidates could answer using pseudocode or program code. Many had not read the first part of the Question 5 (a) where the doCheck function was already shown and tried writing the doCheck function instead of passing a parameter to it as stated in the question. Many candidates were unable to show an understanding of how to open a file and write to it. However there were very many excellent responses to all parts of this question.

Exemplar 3

[Image redrawn from the original mark scheme by an AI model (Gemma 4 12B). It may contain mistakes.]

userInput = getInput("Enter an integer value :")
isCheckedValue = doCheck(userInput)
f = open("test.txt", "w")
f.write(userInput)
f.write(isCheckedValue)
f.close()

In this response the candidate has clearly shown input, calling the doCheck function and assigning the return value to a variable, File is opened and file name is enclosed in quotes and file is closed. The file name is then used to write to the file with the two values.

3(b) 5 marks

Write an algorithm that will:

  • allow the user to enter an integer value
  • pass the value entered into the doCheck() function as a parameter store both the value input and the value returned from the function in a text file with name
  • "storedvalues.txt"

You should write your algorithm using either pseudocode or program code.

Mark scheme 3(b)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

  • input and store/use a value from user

  • call doCheck function with value input from user and save/use returned value

  • open and close text file in write/append mode, if given

  • write value returned to text file

  • Write value input to text file

Guidance

Example code:

num = input("enter a number")
value=doCheck(num)
txtfile =
openWrite("storedvalues.txt")
txtfile.writeLine(num)
txtfile.writeLine(value)
txtfile.close()

MP2 - doCheck is case sensitive

MP3 - need speech marks around file name

Examiner’s Comments

This was a relatively simple algorithm question which candidates could answer using pseudocode or program code. Many had not read the first part of the Question 5 (a) where the doCheck function was already shown and tried writing the doCheck function instead of passing a parameter to it as stated in the question. Many candidates were unable to show an understanding of how to open a file and write to it. However there were very many excellent responses to all parts of this question.

Exemplar 3

[Image redrawn from the original mark scheme by an AI model (Gemma 4 12B). It may contain mistakes.]

userInput = getInput("Enter an integer value :")
doCheckValue = doCheck(userInput)
f = open("test.txt", "w")
f.write(userInput)
f.write(doCheckValue)
f.close()

In this response the candidate has clearly shown

input, calling the doCheck function and assigning the return value to a variable, File is opened and file name is enclosed in quotes and file is closed. The file name is then used to write to the file with the two values.

out of 5

Question 4

9 marks

4

Sundip writes an algorithm to carry out addition and subtraction. The algorithm will use an initially empty stack with the identifier numbers and will take input from the user.

The action the algorithm takes depends on the value input by the user. These actions are listed in Fig. 2.

[Diagram redrawn from the original paper by an AI model (Gemma 4 12B). It may contain mistakes.]

Value inputAction to take
A• Pop two values from the numbers stack<br>• Add the two values<br>• Push the result back onto the numbers stack
S• Pop two values from the numbers stack<br>• Subtract the first popped value from the second<br>• Push the result back onto the numbers stack
E• Pop one value from the numbers stack<br>• Output this value<br>• End program
Any other value• Push the input value to the numbers stack

Fig. 2

4(i) 3 marks

Complete the diagram to show the state of the stack after each value is entered into the algorithm. The letters will complete an action stated in Fig. 2.

The state of the stack after the first value, 8, has been completed for you.

[Diagram redrawn from the original paper by an AI model (Gemma 4 12B). It may contain mistakes.]

Input87A6
8
Mark scheme 4(i)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

  • 8, 7

  • 15

  • 15,6

Guidance

One mark per stack diagram

Examiner’s Comments

This question was generally well answered although some candidates struggled to understand the concept of a stack and how data is pushed on to it and popped from it.

out of 3

4(ii) 3 marks

Complete the following table to give the output from this algorithm when the following set of inputs are entered by the user. The letters will complete an action stated in Fig. 2.

Input data (from left to right)Output
9 3 A E
10 5 A 8 S E
25 5 S 2 3 A S E
Mark scheme 4(ii)
  • 12

  • 7

  • 15

Guidance

Examiner’s Comments

This was generally well answered, with the biggest misunderstanding being the way the subtraction occurs.

4(iii) 3 marks

If the user enters 4 2 S A E , the algorithm will not work correctly.

Explain what problem this input data will cause and why the problem occurs.

Mark scheme 4(iii)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

  • S causes the two values inputted to be popped and only one value to be pushed back / 4 and 2 are popped and 2 is pushed

  • A causes an attempt to pop two values but only one present / not two values there

  • Causing a stack underflow

Guidance

Examiner’s Comments

Many candidates were able to gain at least one mark on this question for stating that the addition would only be able to pop one number. The candidates who gained full marks were able to state the type of error correctly and explain why

there was only one value able to be popped after the subtraction.

out of 3

Question 5

3 marks

5

Fig. 5 shows a graph data structure representing a small section of a parcel delivery network. Each node represents an address where deliveries need to be made. The edges show the possible routes and distances between these deliveries.

[Diagram redrawn from the original paper by an AI model (Gemma 4 12B, checked by Claude Sonnet). It may contain mistakes.]

flowchart TD
    A ---|3| B
    B ---|7| D
    B ---|3| E
    D ---|3| C
    D ---|11| H
    C ---|7| E
    E ---|3| F
    F ---|7| G
    G ---|3| H

Fig. 5

5(i) 1 mark

State why performance modelling is used to test a system.

Mark scheme 5(i)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

1 mark per bullet to max 1

  • Simulate/model behaviour of the system (before it is) used under load

  • Because it would be too expensive/unsafe/time critical to test the real system

Guidance

Examiner’s Comments

The concept of stress testing a system by simulating heavy loads seemed to be poorly understood by most candidates. Many candidates often confused this with the general testing of a system to find bugs.

out of 1

5(ii) 2 marks

Describe how performance modelling can be used in the delivery system.

Mark scheme 5(ii)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

1 mark per bullet to max 2
e.g.

  • Test with large and small values

  • e.g. largest number of deliveries

  • e.g. largest number of possible routes

  • Model how well the system scales with increasing use.

Guidance

Examiner’s Comments

There was much confusion over testing a system in general to determine whether an individual route was effective in the graph given, and the actual performance of the system as a whole in terms of the overall time taken to actually perform the calculations required. The majority of candidates did not appreciate that performance modelling looks at the effect of escalating loads on a system.

out of 2

Question 6

12 marks

6

A program is amended to include the use of several queue data structures.

6(i) 3 marks

Describe how an array can be used to implement a queue data structure.

Mark scheme 6(i)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

1 mark per bullet to max

  • Queue has head pointer and tail pointer

  • When an item is enqueued the tail pointer increments

  • When an item is dequeued the head pointer increments

Guidance

Max 1 mark for Enqueue/Dequeue operations if description of effect on tail/head pointers not given

Examiner’s Comments

Many candidates identified the need to have a head/tail pointer but struggled to gain more than 1 mark by expanding on how enqueue and dequeue

operations would be implemented.

Some candidates continued to talk about push/pop operations for a queue rather than
enqueue/dequeue and often gave properties of a queue in general such as First In First Out rather than answering the question.

out of 3

6(ii) 9 marks

* Discuss the use of object-oriented programming and procedural programming to create and manipulate the queue data structures.

You should include the following in your answer:

  • the features of object-oriented programming
  • the features of procedural programming the benefits of using object-oriented instead of procedural programming when creating several queue
  • structures.
Mark scheme 6(ii)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

Mark Band 3 – High level
(7-9 marks)
The candidate demonstrates a thorough knowledge and understanding of object-oriented and procedural programming; the material is generally accurate and detailed.
The candidate is able to apply their knowledge and understanding directly and consistently to the context provided.
Evidence/examples will be explicitly relevant to the explanation. There is a well-developed line of reasoning which is clear and logically structured. The information presented is relevant and substantiated.

Mark Band 2 – Mid level
(4-6 marks)
The candidate demonstrates reasonable knowledge and understanding of object-oriented and procedural programming; the material is generally accurate but at times underdeveloped. The candidate is able to apply their knowledge and understanding directly to the context provided although one or two opportunities are missed. Evidence/examples are for the most part implicitly relevant to the explanation.
The candidate provides a reasonable discussion, the majority of which is focused. Evaluative comments are, for the most part appropriate, although one or two opportunities for development are missed.

There is a line of reasoning presented with some structure. The information presented is in the most part relevant and supported by some evidence.

Mark Band 1 – Low Level
(1-3 marks)
The candidate demonstrates a basic knowledge of object-oriented and procedural programming with limited understanding shown; the material is basic and contains some inaccuracies. The candidates makes a limited attempt to apply acquired knowledge and understanding to the context provided.
The candidate provides a limited discussion which is narrow in focus. Judgements if made are weak and unsubstantiated. The information is basic and comunicated in an unstructured way. The information is supported by limited evidence and the relationship to the evidence may not be clear.

0 marks
No attempt to answer the question or response is not worthy of credit.

Guidance

AO1: Knowledge and Understanding
Indicative content

  • OOP defines an object as an independent entity
  • OOP defines the attributes of the object and the methods that can be applied to it
  • attributes could be private to restrict accidental changes
  • Procedural the statements are executed in the order they are written

AO2: Application

  • OOP allows for an object to be created from the queue
  • Many instances of this queue can then be declared in the main program.
  • Procedural will need each queue to be declared individually
  • Procedural will need to make use of subroutines where the queue will need to be sent and returned each time.

AO3: Evaluation

  • OOP you can create multiple instances of the queue as required by the program without having to re-write all of the declarations etc. In procedural you would have to write separate code for each new stack
  • OOP reduces amount of code needed therefore fewer errors are likely as code is written once and then used multiple times
  • OOP can reduce mistakes because the subroutines are self-contained in procedural it would need to make sure the correct values are passed and returned, or global variables may be required which uses excess memory.

Examiner’s Comments

Many candidates were able to identify some elements of OOP and Procedural programming to achieve a Level 1 response or were able to describe features in detail for a Level 2 response. Far fewer were able to apply this to the specific context to achieve a Level 3 response.

Those with good knowledge of OOP stood out in terms of giving clear evaluations of multiple queues generated from instance of the class, encapsulation to reduce side effects and possibilities for inheritance for different types of queues.

Many did not describe the necessary creation of enqueue and dequeue subroutines in procedural programming for each separate queue or the need to pass queues to or returning queues from subroutines.

[An examiner's marking symbol, not shown here.]

Misconception

There was a lot of confusion between inheritance and instantiation, e.g. “when creating several queues you can use inheritance, so all queues inherit attributes and methods”.

Candidates need to be clear that each instance of a class is assigned the attributes of the class and has access to all associated methods.

out of 9

Question 7

12 marks

7(a) 9 marks

* A programmer has been asked by a client to create a complex computer program. Compare the spiral model and waterfall lifecycle methodologies for this task.

You should include the following in your answer:

  • how both methodologies could be used to develop a complex computer program
  • the benefits of each methodology for this task
  • the drawbacks of each methodology for this task.
Mark scheme 7(a)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

Mark Band 3–High Level (7-9 marks)
The candidate demonstrates a thorough knowledge and understanding of both waterfall and the spiral model. The material is generally accurate and detailed.

The candidate is able to apply their knowledge and understanding directly and consistently to the context provided.
Evidence/examples will be explicitly relevant to the explanation.

The candidate provides a thorough discussion which is well balanced. Evaluative comments are consistently relevant and well- considered.

9 (AO1.1), (2) (AO1.2), (2), (AO2.1) (2), (AO3.3). (3)

There is a well-developed line of reasoning which is clear and logically structured. The information presented is relevant and substantiated.

Mark Band 2-Mid Level (4-6 marks)
The candidate demonstrates reasonable knowledge and understanding of waterfall and/or the spiral model; the material is generally accurate but at times underdeveloped.

The candidate is able to apply their knowledge and understanding directly to the context provided although one or two opportunities are missed. Evidence/examples are for the most part implicitly relevant to the explanation.

The candidate provides a sound discussion, the majority of which is focused. Evaluative comments are for the most part appropriate, although one or two opportunities for development are missed.

There is a line of reasoning presented with some structure. The information presented is in the most part relevant and supported by some evidence.

Mark Band 1-Low Level (1-3 marks)
The candidate demonstrates a basic knowledge of some aspects of either waterfall or the spiral model; the material is basic and contains some inaccuracies. The candidate makes a limited attempt to apply acquired knowledge and understanding to the context provided.

The candidate provides a limited discussion which is narrow in focus. Judgments if made are weak and unsubstantiated. The

information is basic and communicated in an unstructured way. The information is supported by limited evidence and the relationship to the evidence may not be clear.

0 marks
No attempt to answer the question or response is not worthy of credit.

Guidance

AO1
The spiral model has four quadrants (determine objectives, identify and manage risk, develop and test, plan next iteration). Client feedback then informs future development and prototypes which feedback into future revisions. Waterfall has a structured analysis/design/development/test flow. Progress to the next step is not made until the previous step is completed.

AO2
The spiral model relies on frequent client

feedback. Spiral produces functional prototypes where features are added incrementally. Spiral model has more focus on risk; projects may be modified or even dropped if risk is too great. Waterfall is much more structured and very reliant on getting the definition of requirements correct at the start; changes are harder to add in at a later stage. However, this forces the definition to be well understood.

AO3
Spiral involves client feedback, prototypes and evolving projects. Better option where
requirements may change. Waterfall is better where requirements are very clear to begin with and outcomes known. Spiral is better for risk management. If the programmer has a large team then waterfall may be more appropriate due to the clearly defined responsibilities at each stage.

Examiner’s Comments
Most candidates gained some marks on this question. Most could explain that spiral was iterative and waterfall was done in linear stages, but many did not expand on this. Few candidates linked their answer to the complex computer program mentioned in the question. Some candidates also described waterfall as iterative.

out of 9

7(b)

A programmer creates this function shown in Fig. 5 using a high-level language.

[Diagram redrawn from the original paper by an AI model (Gemma 4 12B). It may contain mistakes.]

function mystery(x,y)

    total = x + y

    while x >= 10 then

        x = x - 10

        y = y - 10

        total = total + x + y

    endwhile

    return total

endfunction

Fig. 5

7(b)(i) 1 mark

State the value output by the line print(mystery(10,20))

Mark scheme 7(b)(i)
  • 40

Guidance

CAO

7(b)(ii) 1 mark

State the value output by the line print(mystery(0,70))

Mark scheme 7(b)(ii)
  • 70

Guidance

CAO

7(b)(iii) 1 mark

State the value output by the line print(mystery(45,55))

Mark scheme 7(b)(iii)
  • 300

Guidance

CAO

Question 8

11 marks

8(a) 2 marks

George owns a small book shop. He wants a program to work out the daily sales figures.

He uses a text file called “Sales.txt” shown in Fig. 1. Each line represents the sales total for a different day of the week. The program can run at any point during the week and therefore the text file may not have seven lines.

2367.34
1986.92
2251.49
1882.40
2412.83
3411.32
2721.76

The program needs to read the text file and then calculate:

  • The number of days that the program is calculating over
  • The total sales over that period
  • The average daily sales over that period

At the end of the text file, it should then print the results of these calculations to the screen.

George will use iteration to read through the values in the text file.

Describe how George can use iteration when reading from the text file.

Mark scheme 8(a)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

1 mark per bullet up to a maximum of 2 marks, e.g:

  • To setup a loop…

  • To repeat (the same block of code)

  • for each line in the text file / until each value has been read

Guidance

Examiner’s Comments
This was also answered well although some candidates used the word ‘iteration’ in their answer without going to describe what this means. As this was in the question, further detail was required such as repeating or looping through the text file.

out of 2

8(b) 7 marks

Write a procedure called salesAnalysis that will meet the rules of George’s program.

You should write your procedure using pseudocode or program code.

Mark scheme 8(b)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

1 mark per bullet up to a maximum of 7 marks:

  • Suitable logic for initialising variables outside of loop

  • Suitable logic for opening and closing Sales.txt

  • Suitable use of a loop which ends when the last line has been reached in Sales.txt

  • Suitable logic for reading each line of data from file variable

  • Suitable logic for increasing total (and count) including conversion from string to numeric data type

  • Suitable logic for calculating averages by dividing total by count

  • Suitable logic for printing the number of days, the total sales and the daily average

Guidance

Some points (for example 5 & 6) can be combined onto one line.

Example Solution:

procedure salesAnalysis():
    dayCount = 0
    salesTotal = 0
    dailySales =
openRead("Sales.txt")
    while NOT dailySales.endOfFile()
      dailySaleFigure = float
(percentageFile.readLine())
      salesTotal + =
dailySaleFigure
      dayCount + = 1
    endwhile
    dailyAverage = salesTotal
/dayCount
    print(“Over ” + dayCount + “
days there was a total sales of £” _+
salesTotal + “ and an average daily
sale of £” + dailyAverage)
    dailySales.close()
endprocedure

There are many different ways that this procedure could have been achieved. Therefore other alternative methods should be given credit.

Examiner’s Comments
Most candidates achieved a few marks, but few achieved the maximum marks available. The question states that pseudocode or program code could be used so a variety of answers were given.

The OCR pseudocode guide gives guidance on how to write pseudocode including data structures, constructs, and reading/writing to file. Some candidates wrote neither pseudocode or program code and therefore were given no marks.

Many candidates remembered to open the sales file, but many forgot to close the file. Initialising the variables before the loop was also missed by a number of candidates.

Increasing the total was included in many responses, although many forgot to cast the total to a numeric data type to enable this to work correctly.

Many candidates achieved the last 2 marks for calculating the average and then displaying the calculated values. Some missed the final output as the text was incorrectly concatenated with the variable values.

Exemplar 3

[Image redrawn from the original mark scheme by an AI model (Gemma 4 12B). It may contain mistakes.]

SalesFile = open("Sales.txt")
numDays = 0
total = 0
while not EOF:
    line = SalesFile.readline()
    Sales = Float(line)
    numDays = numDays + 1
    total = total + Sales
endwhile
SalesFile.close()
print("The number days sales are " + Str(numDays))
print("The total sales are " + Str(total))
average = total / numDays
print("The average sales are " + Str(average))

Exemplar 3 was given full marks. The candidate has gained the first mark for initialising the variables “numofdays” and “total”. The second mark has been awarded for the first line, which opens the sales file and closing the file after the

loop has finished. The while loop gains the third mark which repeats until the end of the file is reached. The fourth mark is awarded for reading each line of the file correctly. The fifth mark correctly increases total in each iteration. Sale has been correctly converted to a “float” data type beforehand to make this possible. The sixth mark is awarded for calculating the average on the penultimate line. The final mark is awarded for printing the number of days, total sales and the daily average. This has been concatenated correctly with a plus symbol. Some candidates used the comma which was also acceptable.

The syntax provided in this example relates to Python whereas some candidates wrote pseudocode or another high-level language. Some candidates lost marks for writing the steps in everyday English which is not what the question stipulated.

out of 7

8(c) 2 marks

When the values are being read from the Sales.txt file they will be a string data type.

In order for them to be processed they will need to be cast (i.e. converted) to a different data type.

Explain what data type the values in “Sales.txt” should be converted to.

Mark scheme 8(c)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

1 mark per bullet up to a maximum of 2 marks, e.g:

  • Float/real/double/single/decimal/currency…

  • …because the values in the text file contain a decimal space…

  • …representing monetary values…

  • ….the values will be used in calculations

Guidance

Examiner’s Comments
This was generally answered well although some candidates picked Integer for the data type which would not be accurate given that averages are likely to be a decimal value. There are a range of data types that support decimal values, any of which would be acceptable as an answer.

out of 2

Question 9

8 marks

9

An object-oriented system is implemented to organize a company’s information about staff attendance. Classes, objects, methods and attributes are used in this system.

9(i) 3 marks

State the meaning of each of the following terms:

Object

Method

Attribute

Mark scheme 9(i)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

  • Object – instantiated from class

  • Method – action object performs / link to procedure/functions

  • Attribute – value held by object / link to variable

out of 3

9(ii) 5 marks

Each worker has a name and an attendance figure which can be between 0 and 100.

Write a definition for a fully encapsulated worker class, providing both get and set methods for all attributes. You do not have to write code for the constructor method.

Mark scheme 9(ii)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

  • Class definition statement

  • Defining name and attendance attributes

  • Appropriate get methods for name and attendance that return a value and have no parameter

  • Appropriate set methods for name and attendance that take a parameter

  • …that restricts attendance to be 0 to 100.

Guidance

Example answer

class Worker
  private name
  private attendance

  public function getName()
     return name
  end function

  public function
  getAttendance()
     return attendance
  end function

  public procedure
  setName(newName)
     name = newName
  end procedure

  public procedure
  setAttendance(newAttend)
     if newAttend >=0 and
     newAttend <=100 then
        attendance =
        newAttend
     end if
  end procedure
end class
out of 5

Question 10

4 marks

10 4 marks

A program written using the Little Man Computer instruction set is shown in Fig. 1.

[Diagram redrawn from the original paper by an AI model (Gemma 4 12B). It may contain mistakes.]

        INP
        STA  numone
        INP
        STA  numtwo
main     LDA  numone
        SUB  numtwo
        BRP  pos
notpos   LDA  count
        OUT
        LDA  numone
        OUT
        HLT
pos       STA  numone
        LDA  count
        ADD  one
        STA  count
        BRA  main
numone    DAT
numtwo    DAT
one       DAT  1
count     DAT  0

Fig. 1

Write an algorithm using pseudocode that has the same functionality as the code in Fig. 1.

Mark scheme 10

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

  • Input two numbers into two separate variables / other suitable data structure

  • Correctly calculate integer division

  • Correctly calculate remainder

  • Print out both

Guidance

Can be completed either by using MOD / DIV or by using repeated subtraction as in LMC example

out of 4

Question 11

9 marks

11(a) 4 marks

A website charges a booking fee of £2.99 on each ticket sold. In addition, if the tickets are purchased from outside of the UK, £4.99 is added to the booking fee. The booking fee is calculated using a JavaScript function named bookingfee().

Complete the definition of the bookingfee() function below.

function bookingfee(numtickets, country) {

  var nonUKprice = 4.99;

  var perTicketPrice = ……;

  var total = 0;

  if (country!="UK") {

     total = total + ……;

  }

  total = total + (…… * perTicketPrice);

  …… total;

}
Mark scheme 11(a)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

  • 2.99

  • nonUKprice

  • numtickets

  • return

Guidance

Correct answer only. Penalise spelling if incorrect.

Do not accept £ sign in first bullet point.

out of 4

11(b)

The JavaScript function above is used to show users the booking fee. When users click to buy the tickets, the booking fee is calculated again on the server.

11(b)(i) 3 marks

Explain why server side processing is used to recalculate the booking fee.

Mark scheme 11(b)(i)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

  • processing done away from the user’s control/Client side processing could be altered

  • Browser may not support client-side language/ scripting could be turned off

  • Booking fee calculation needs to be correct for all locations

out of 3

11(b)(ii) 2 marks

Explain one advantage of client side processing to either the customer buying the tickets, or to company who own the website.

Mark scheme 11(b)(ii)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

To the customer any 2x1:

  • No need to submit to server and wait for response

  • Website will work more quickly for user

To the company any 2x1:

  • Reduces load on the server

  • Will need to spend less on processing power/bandwidth

out of 2

Question 12

16 marks

12(a) 5 marks

Hugh has written a recursive function called thisFunction() using pseudocode.

01 function thisFunction(theArray, num1, num2, num3)
02  result = num1 + ((num2 - num1) DIV 2)
03  if num2 < num1 then
04    return -1
05  else
06    if theArray[result] < num3 then
07      return thisFunction(theArray, result + 1, num2, num3)
08    elseif theArray[result] > num3 then
09      return thisFunction(theArray, num1, result - 1, num3)
10    else
11      return result
12    endif
13  endif
14 endfunction

The function DIV calculates integer division, e.g. 5 DIV 3 = 1

theArray has the following data:

Index:01234567
Data:510152025303540

Trace the algorithm, and give the final return value, when it is called with the following statement:

thisFunction(theArray, 0, 7, 35)

You may choose to use the table below to give your answer.

Function callnum1num2num3result
thisFunction(theArray,0,7,35)

Final return value ……

Mark scheme 12(a)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

1 mark per bullet

  • Calculation of result to 3

  • Call with thisFunction(theArray, num1=4,

num2=7, num3=35)
  • Result = 5

  • call with

thisFunction(theArray,num1=6,num2=7,num3=35)
  • (Result = 6) return of value 6

Function call num1 num2 num3 result

thisFunction

0 7 35 3

(theArray,0,7,35)
thisFunction

4 7 35 5

(theArray,4,7,35)
thisFunction

6 7 35 6

(thisArray,6,7,35)

Function call

num1

num2

num3

result

thisFunction
(theArray,0,7,35)
thisFunction
(theArray,4,7,35)
thisFunction
(thisArray,6,7,35)

Guidance

7

35

3

7

35

5

7

35

6

out of 5

12(b) 1 mark

State the name of the standard algorithm thisFunction() performs.

Mark scheme 12(b)

Binary search

12(c) 4 marks

Hugh could have written thisFunction() using iteration instead of recursion.

Compare two differences between recursion and iteration.

1

2

Mark scheme 12(c)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

1 mark per bullet to max 4, e.g.

  • Recursion uses more memory…

  • …iteration uses less memory

  • Recursion declares new variables /variables are put onto the stack each time…

  • …iteration reuses the same variables

  • Recursive can run out of memory/stack space…

  • …while iteration cannot run out of memory

  • Recursion can express a problem more elegantly / in fewer lines of code…

  • …while iteration can take more lines of code / be harder to understand

  • Recursion will be self-referential / will call itself…

  • … whereas iteration does not

out of 4

12(d) 6 marks

The recursive function thisFunction() is printed again here for your reference.

01 function thisFunction(theArray, num1, num2, num3)
02  result = num1 + ((num2 - num1) DIV 2)
03  if num2 < num1 then
04    return -1
05  else
06    if theArray[result] < num3 then
07      return thisFunction(theArray, result + 1, num2, num3)
08    elseif theArray[result] > num3 then
09      return thisFunction(theArray, num1, result - 1, num3)
10    else
11      return result
12    endif
13  endif
14 endfunction

Rewrite the function thisFunction() so that it uses iteration instead of recursion.

You should write your answer using pseudocode or program code.

Mark scheme 12(d)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

1 mark per bullet to max 6

  • Retains function call

  • Uses a loop

  • …that will loop until all elements inspected or value found

  • Updates num1 appropriately

  • Updates num2 appropriately

  • Returns -1 in the correct place if the value has not been found

  • Returns the result in the correct place if the value has been found

e.g.

function thisFunction(theArray, num1, num2, num3)
while (true)
  result = num1 + ((num2 - num1) DIV 2)
  if num2 < num1 then
   return -1
  else
   if theArray[result] < num3 then
    num1 = result + 1
   elseif theArray[result] > num3 then
    num2 = result - 1
   else
    return result
   endif
  endif
endwhile
endfunction
out of 6

Question 13

6 marks

13

The Little Man Computer (LMC) instruction set can be used to write programs using assembly language.

Fig. 3 shows assembly code written using the LMC instruction set.

[Diagram redrawn from the original paper by an AI model (Gemma 4 12B). It may contain mistakes.]

INP
STA X
SUB Y
BRP jump
LDA X
STA Z
HLT

jump LDA Y
STA Z
HLT

X DAT 0
Y DAT 5
Z DAT 0

Fig. 3

13(i) 1 mark

Tick one box to indicate the programming construct that is not used in Fig. 3.

Sequence

Selection

Iteration

Mark scheme 13(i)
  • Iteration

13(ii) 1 mark

When the program is run, 7 is input by the user.

State the value that will be in the memory location Z when the program has run with this input.

Mark scheme 13(ii)
  • 5

13(iii) 4 marks

Write an equivalent version of the LMC assembly code shown in Fig. 3 for a procedural programming language.

You should write your code using pseudocode or program code.

Mark scheme 13(iii)

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

1 mark per bullet up to a maximum of 4 marks, e.g:

  • Initialise Y and Z AND set X

  • Correct use of IF

  • Correct condition (e.g. if X >= Y then)

  • Assignment of Z in correct places

Guidance

X Y Z variable alternatives are acceptable Solution:

X = input()
Y = 5
Z = 0
if X >= Y then
   Z = Y
else
   Z = X
Endif
out of 4

Question 14

9 marks

14 9 marks

*OCR Car Park would like to calculate the parking charges when a car leaves their car park.

They will need to record the time that a car enters and leaves their car park in order to calculate the parking charge.

Discuss the different methods that could be used to collect this data.

In your answer you should include:

  • The benefits and drawbacks of each method
  • Ethical implications
  • Legal implications

END OF QUESTION PAPER

Mark scheme 14

Tick each point your answer makes. Your mark is worked out from your ticks, and you can change it.

Mark Band 3–High Level
(7-9 marks)

The candidate demonstrates a thorough knowledge and understanding of relevant data collection methods. They have covered a range of ethical issues and relevant legislation; the material is generally accurate and detailed across all three. The candidate is able to apply their knowledge and understanding directly and consistently to the context provided.
Evidence/examples will be explicitly relevant to the explanation. The candidate has used a range of ethical implications and laws to justify their conclusion

There is a well-developed line of reasoning which is clear and logically structured. The information presented is relevant and substantiated.

Mark Band 2-Mid Level
(4-6 marks)
The candidate demonstrates reasonable knowledge and understanding of relevant data collection methods. They have covered ethical issues and relevant legislation; the material is generally accurate but at times underdeveloped.
The candidate is able to apply their knowledge and understanding directly to the context provided although one or two opportunities are missed. Evidence/examples are for the most part implicitly relevant to the explanation.
The candidate has either good consideration of ethical issues or legal issues or a weaker consideration of both. These are used to come to some justification although it may not be completely justifiable.

There is a line of reasoning presented with some structure. The information presented is in the most part relevant and supported by some evidence.

Mark Band 1-Low Level
(1-3 marks)
The candidate demonstrates a basic knowledge of relevant data collection methods. They have covered ethical issues or relevant legislation; the material is basic and contains some inaccuracies. The candidate makes a limited attempt to apply acquired knowledge and understanding to the context provided.
The candidate provides comes to a conclusion though there may be little considerations of legal or ethical issues to back it up.

The information is basic and communicated in an unstructured way. The information is supported by limited evidence and the relationship to the evidence may not be clear.

0 marks
No attempt to answer the question or response is not worthy of credit.

Guidance

AO1.1

  • Automatic Number Plate Recognition (ANPR) could be used. This makes use of OCRto turn number plates on camera into digital characters.
  • Use of a token/ticket could be used when cars enter the car park which is time stamped.
  • Staff could be employed to manually record the time cars enter the car park and then again when cars leave.
  • Sensor could be used to detect cars entering / leaving the car park.
  • Photographs of vehicles can be taken when cars enter / leave the car park. These can be time stamped.

AO2.1

  • Data will be input into an algorithm that will work out the price based on amount of time car has spent in car park.
  • If the car park is considering storing videos / photographs of the cars then they will need to follow current data protection legislation as these may contain faces of people.
  • Car park users may see this as an invasion of privacy. Civil liberty issues as movements are being tracked / monitored.
  • Automated systems are likely to be more reliable and will produce statistical data that

can be analysed better.
Manual methods may be prone to human error. Automatic methods will allow for quicker processing than if a human was doing it.

  • Lower overheads as no human to employ.
  • They could connect to the other databases (e.g. police and DVLA) to check that cars are genuine (e.g. can check if cars have been stolen)
  • If connecting the cameras over the internet, then this would make them susceptible to hackers and therefore security methods would need to be put in place.

AO3.3

  • If automated systems are used then this can lead to improved customer satisfaction and lower costs due to streamlined system. However this could lead to less employment in the local area as computer systems taking over jobs.
  • Some people may be afraid of using carpark due to cameras.
  • Data protection laws should mean consumers are protected o System secure o Data only stored for a short time o Only relevant data stored
out of 9