Data types, records, arrays and abstract data types – A Level Computer Science (9618)

162 questions · page 7 of 11

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
91
9618/21/O/N/23 · Question 3Oct/Nov 2023Paper 218 marks
Loading question…
Question text

3
The diagram represents an Abstract Data Type (ADT).
The operation of this stack may be summarised as follows:
•
The TopOfStack pointer points to the last item added to the stack.
•
The BottomOfStack pointer points to the first item on the stack.
Stack
← TopOfStack
D1
D3
D4
D5
← BottomOfStack
D2
(a) The stack is implemented using two variables and a 1D array of 8 elements as shown.
The variables are used to reference individual elements of the array, in such a way that:
•
the array is filled from the lowest indexed element towards the highest
•
all the elements of the array are available for the stack.
Complete the diagram to represent the state of the stack as shown above.
Array
Data
element
8
7
6
5
Variable
TopOfStack
4
BottomOfStack
3
2
1
[3]
(b) A function Push() will add a value onto the stack by manipulating the array and variables in
part (a).
Before adding a value onto the stack, the algorithm will check that space is available.
If the value is added to the stack, the function will return TRUE, otherwise it will return FALSE.
The algorithm is expressed in five steps.
Complete the steps.
1.
If … then return FALSE
2.
Otherwise … TopOfStack
3.
Use TopOfStack as an … to the array.
4.
Set the element at this … to the … being added.
5.
Return … .
[5]

92
9618/21/O/N/23 · Question 4Oct/Nov 2023Paper 219 marks
Loading question…
Question text

4
A global array is declared in pseudocode as follows:
DECLARE Data : ARRAY[1:150] OF STRING
A function TooMany() will:
1.
take two parameters:
•
a string (the search string)
•
an integer (the maximum value)
2.
count the number of strings in the array that exactly match the search string
3.
return TRUE if the count is greater than the maximum value, otherwise will return FALSE
(a) Write pseudocode for the function TooMany().
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
(b) The global array is changed to a 2D array, organised as 150 rows by 2 columns. It is declared
in pseudocode as follows:
DECLARE Data : ARRAY[1:150, 1:2] OF STRING
The algorithm for the function in part (a) is changed. Strings will only be counted if both of
the following conditions are true:
•
The current row is an even number.
•
The search string exactly matches the value in either column.
Write pseudocode to check these conditions.
Assume that the row index is contained in variable Row and the search string in variable
Search.
…
…
…

93
9618/21/O/N/23 · Question 8Oct/Nov 2023Paper 2119 marks
Loading question…
Question text

8
A class of students are developing a program to send data between computers. Many computers
are connected together to form a wired network. Serial ports are used to connect one computer to
another.
Each computer:
•
is assigned a unique three-digit ID
•
has three ports, each identified by an integer value
•
is connected to between one and three other computers.
Messages are sent between computers as a string of characters organised into fields as shown:
<STX><DestinationID><SourceID><Data><ETX>
Field
Field name
Description
number
a single character marking the start of the message
STX
n/a
(ASCII value 02)
DestinationID
1
three numeric characters that identify the destination computer
SourceID
2
three numeric characters that identify the source computer
a variable length string containing the data being sent
Data
3
(Minimum length is 1 character)
a single character marking the end of the message
ETX
n/a
(ASCII value 03)
For example, the following message contains the data "Hello Kevin" being sent from computer
"101" to computer "232":
<STX>"232101Hello Kevin"<ETX>
Each computer will run a copy of the same program. Each program will contain a global variable,
MyID of type string, that contains the unique ID of the computer in which the program is running.
The programmer has defined the first two program modules as follows:
Module
Description
• takes two parameters:
o a string containing a message
Transmit()
(already written)
o an integer containing a port number
• transmits the message using the given port
• takes three parameters:
o a string containing a text file name
o a string containing a Destination ID
SendFile()
o an integer containing a Port number
• transmits the file one line at a time
• transmits a final message with data string "****"
(a) Write pseudocode for module SendFile().
Assume:
•
module Transmit() has already been written and is used to transmit a message
•
the value of MyID may be used as SourceID
•
the file specified contains no blank lines
•
the file specified does not contain the line "****"
…
…
…
…
…
…
…
…
…
…
…
…
…
…

Advertisement
94
9618/22/O/N/23 · Question 1Oct/Nov 2023Paper 2211 marks
Loading question…
Question text

1
A shop sells car accessories. A customer order is created if an item cannot be supplied from
current stock. A program is being developed to create and manage the customer orders.
(a) The following identifier table shows some of the data that will be stored for each order.
Complete the identifier table by adding meaningful variable names and appropriate data
types.
Example
Explanation
Variable name
Data type
value
"Mr Khan"
The name of the customer
3
The number of items in the order
TRUE
To indicate whether this is a new customer
15.75
The deposit paid by the customer
[4]
(b) Other variables in the program have example values as shown:
Variable
Example value
Total
124.00
DepRate
2.00
Description
"AB12345:Cleaning Brush (small)"
Complete the table by evaluating each expression using the example values.
Expression
Evaluates to
(Total * DepRate) + 1.5
RIGHT(Description, 7)
(LENGTH(Description) - 8) > 16
NUM_TO_STR(INT(DepRate * 10)) & '%'
[4]
(c) The data that needs to be stored for each customer order in part (a) is not all of the same
type.
Describe an effective way of storing this data for many customer orders while the program is
running.
…
…
…
…
…
… [3]

95
9618/22/O/N/23 · Question 3Oct/Nov 2023Paper 229 marks
Loading question…
Question text

3
The diagram represents a linked list Abstract Data Type (ADT).
•
Ptr1 is the start pointer. Ptr2 is the free list pointer.
•
Labels D40, D32, D11 and D100 represent the data items of nodes in the list.
•
Labels F1, F2, F3 and F4 represent the data items of nodes in the free list.
•
The symbol Ø represents a null pointer.
Ptr1
D40
D32
D11
D100
Ø
Ptr2
F1
F2
F3
F4
Ø
(a) The linked list is implemented using two variables and two 1D arrays as shown.
The pointer variables and the elements of the Pointer array store the indices (index numbers)
of elements in the Data array.
Complete the diagram to show how the linked list as shown above may be represented using
the variables and arrays.
Variable
Value
Start_Pointer
Free_List_Pointer
5
Index
Data array
Pointer array
1
D32
2
2
3
3
4
D40
5
6
F2
7
7
8
[5]
(b) The original linked list is to be modified. A new node D6 is inserted between nodes D32 and
D11.
Ptr1
D40
D32
D11
D100
Ø
Ptr2
F1
F2
F3
F4
Ø
The algorithm required is expressed in four steps as shown.
Complete the steps.
1.
Assign the data item … to … .
2.
Set the … of this node to point to … .
3.
Set Ptr2 to point to … .
4.
Set pointer of … to point to … .
[4]

96
9618/22/O/N/23 · Question 5Oct/Nov 2023Paper 2230 marks
Loading question…
Question text

5
A global 1D array of integers contains four elements, which are assigned values as shown:
← 1
Mix[1]
← 3
Mix[2]
← 4
Mix[3]
← 2
Mix[4]
A procedure Process() manipulates the values in the array.
The procedure is written in pseudocode:
PROCEDURE Process(Start : INTEGER)
DECLARE Value, Index, Count : INTEGER
← Start
Index
← 0
Count
REPEAT
←
Mix[Index]
Value
←
Mix[Index] - 1
Mix[Index]
←
Value
Index
←
Count + 1
Count
UNTIL Count = 5
← Count * Index
Mix[4]
ENDPROCEDURE
Complete the trace table on the opposite page by dry running the procedure when it is called as
follows:
CALL Process(3)
Index
Value
Count
Mix[1]
Mix[2]
Mix[3]
Mix[4]
[6]

97
9618/22/O/N/23 · Question 8Oct/Nov 2023Paper 2218 marks
Loading question…
Question text

8
A class of students are developing a program to send data between computers. Many computers
are connected together to form a wired network. Serial ports are used to connect one computer to
another.
Each computer:
•
is assigned a unique three-digit ID
•
has three ports, each identified by an integer value
•
is connected to between one and three other computers.
Data is sent as individual message strings.
Each string contains the destination ID (the ID of the computer that is to receive the message)
followed by the data:
<DestinationID><Data>
Messages may pass through several computers on the way to their destination.
When a message arrives at a computer, that is not the destination, the program needs to forward
it on to another computer using one of its serial ports.
The port to use is obtained from information that is stored in an array RouteTable.
RouteTable is a global 2D array of integers. It is declared in pseudocode as follows:
DECLARE RouteTable : ARRAY[1:6,1:3] OF INTEGER
The values in the first two columns of RouteTable define a range of ID values.
Column 3 gives the corresponding port number to use when forwarding the message to a computer
with an ID within this range.
For example, the contents of RouteTable could be:
Column 1
Column 2
Column 3
100
199
1
Row 1
200
259
2
Row 2
−1
<undefined>
<undefined>
Row 3
260
399
2
Row 4
400
599
3
Row 5
600
999
1
Row 6
In this example, a message that arrives with a DestinationID of "283" will be forwarded using
port 2.
Row 3 in the example shows an unused row. These may occur anywhere. Unused rows have the
column 1 element set to −1. The value of unused elements in the other two columns is undefined.
The programmer has defined the first program module as follows:
Module
Description
•
takes a DestinationID as a parameter of type string
•
searches for the range corresponding to the DestinationID
GetPort()
in the array
•
returns the port number, or returns −1 if no corresponding
range is found
(a) Write pseudocode for module GetPort().
Assume DestinationID contains a valid three-digit string.
…
…
…
…
…
…
…
…
…
…
…
…
…

98
9618/23/O/N/23 · Question 2Oct/Nov 2023Paper 239 marks
Loading question…
Question text

2
Data is a 1D array of integers, containing 30 elements. All element values are unique.
(a) An algorithm will output the index of the element with the smallest value.
Draw a program flowchart to represent the algorithm.
START
END
[5]
(b) The 30 data values could have been stored in separate variables rather than in an array.
Explain the benefits of using an array when designing a solution to part (a).
…
… [2]
(c) The requirement changes. Array Data needs to hold 120 elements and each value may
include a decimal place.
Write a pseudocode statement to declare the modified array.
…
… [2]

Advertisement
99
9618/23/O/N/23 · Question 3Oct/Nov 2023Paper 239 marks
Loading question…
Question text

3
The diagram represents a queue Abstract Data Type (ADT).
The organisation of this queue may be summarised as follows:
•
The FrontOfQueue pointer points to the next data item to be removed.
•
The EndOfQueue pointer points to the last data item added.
Queue
← FrontOfQueue
D3
D4
D1
D2
← EndOfQueue
D5
The queue is implemented using three variables and a 1D array of eight elements as shown. The
variable NumItems stores the number of items in the queue.
The pointer variables store indices (index numbers) of the array.
(a) Complete the diagram to represent the state of the queue as shown above.
Index
Array
1
2
3
4
Variable
FrontOfQueue
5
EndOfQueue
6
NumItems
7
5
8
[3]
(b) A module AddTo() will add a value to the queue by manipulating the array and variables in
part (a).
The queue implementation is circular. When pointers reach the end of the queue, they will
‘wrap around’ to the beginning.
Before a value can be added to the queue, it is necessary to check the queue is not full.
The algorithm to add a value to the queue is expressed in six steps.
Complete the steps.
1.
If NumItems … then jump to step 6.
2.
Increment … .
3.
If … then set EndOfQueue to … .
4.
Increment … .
5.
Set the … at the index stored in … to the …
being added.
6.
Stop.
[6]

100
9618/23/O/N/23 · Question 4Oct/Nov 2023Paper 237 marks
Loading question…
Question text

4
A procedure RandList() will output a sequence of 25 random integers, where each integer is
larger than the previous one.
(a) Write pseudocode for procedure RandList().
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
(b) Procedure RandList() is modified so that the random numbers are also written into a
1D array Result.
A new module is written to confirm that the numbers in the array are in ascending order.
This module contains an IF statement that performs a comparison between elements:
IF (Result[x + 1] = Result[x]) OR (Result[x] > Result[x + 1]) THEN
←
FALSE
Sequence
ENDIF
Write a simplified version of the conditional clause.
…
…
… [1]

101
9618/23/O/N/23 · Question 5Oct/Nov 2023Paper 2328 marks
Loading question…
Question text

5
A global 1D array of integers contains four elements, which are assigned values as shown:
← 4
Mix[1]
← 2
Mix[2]
← 3
Mix[3]
← 5
Mix[4]
A procedure Process() manipulates the values in the array.
The procedure is written in pseudocode as follows:
PROCEDURE Process(Start : INTEGER)
DECLARE Value, Index, Total : INTEGER
← Start
Index
← 0
Total
WHILE Total < 20
←
Mix[Index]
Value
←
Total + Value
Total
IF Index < 4 THEN
←
Mix[Index] + Mix[Index+1]
Mix[Index]
ELSE
←
Mix[Index] + Mix[1]
Mix[Index]
ENDIF
←
(Value MOD 4) + 1
Index
ENDWHILE
← Total * Index
Mix[1]
ENDPROCEDURE
Complete the trace table on the opposite page by dry running the procedure when it is called as
follows:
CALL Process(2)
Index
Value
Total
Mix[1]
Mix[2]
Mix[3]
Mix[4]
[6]

102
9618/41/O/N/23 · Question 1Oct/Nov 2023Paper 4116 marks
Loading question…
Question text

1
This iterative pseudocode algorithm for the function IterativeVowels() takes a string as a
parameter and counts the number of lower-case vowels in this string.
The vowels are the letters a, e, i, o and u.
FUNCTION IterativeVowels(Value : STRING) RETURNS INTEGER
DECLARE Total : INTEGER
DECLARE LengthString : INTEGER
DECLARE FirstCharacter : CHAR
← 0
Total
← LENGTH(Value)
LengthString
← 0 TO LengthString - 1
FOR X
FirstCharacter ← MID(Value, 0, 1)
IF FirstCharacter = 'a' OR FirstCharacter = 'e' OR
FirstCharacter = 'i' OR FirstCharacter = 'o' OR
FirstCharacter = 'u' THEN
← Total + 1
Total
ENDIF
← MID(Value, 1, LENGTH(Value)-1)
Value
NEXT X
RETURN Total
ENDFUNCTION
The pseudocode function MID(X, Y, Z) returns Z number of characters from string X, starting
at the character in position Y. The first character in a string is in position 0, for example:
MID("computer", 0, 3) returns "com"
The pseudocode function LENGTH(X) returns the number of characters in the string X, for
example:
LENGTH("computer") returns 8
(a) (i)
Write program code for the function IterativeVowels().
Save your program as Question1_N23.
Copy and paste the program code into part 1(a)(i) in the evidence document.
[5]
(ii)
Write program code to call the function IterativeVowels() with the parameter
"house" from the main program.
Output the return value.
Save your program.
Copy and paste the program code into part 1(a)(ii) in the evidence document.
[2]
(iii)
Test your program.
Take a screenshot of the output.
Save your program.
Copy and paste the screenshot into part 1(a)(iii) in the evidence document.
[1]
(b) (i)
Rewrite the function IterativeVowels() as a recursive function with the identifier
RecursiveVowels().
Save your program.
Copy and paste the program code into part 1(b)(i) in the evidence document.
[6]
(ii)
Write program code to call the function RecursiveVowels() with the parameter
"imagine" from the main program.
Output the return value.
Save your program.
Copy and paste the program code into part 1(b)(ii) in the evidence document.
[1]
(iii)
Test your program.
Take a screenshot of the output.
Save your program.
Copy and paste the screenshot into part 1(b)(iii) in the evidence document.
[1]

103
9618/41/O/N/23 · Question 2Oct/Nov 2023Paper 4129 marks
Loading question…
Question text

2
A linear queue is implemented using the 1D array, Queue. The index of the first element in the
array is 0.
(a) (i)
Write program code to declare:
•
Queue — a global array with space to store 50 IDs of type string
•
HeadPointer — a global variable to point to the first element in the queue,
initialised to −1
•
TailPointer — a global variable to point to the next available space in the queue,
initialised to 0.
Save your program as Question2_N23.
Copy and paste the program code into part 2(a)(i) in the evidence document.
[2]
(ii)
The procedure Enqueue() takes a string parameter.
If the queue is full, the procedure outputs a suitable message. If the queue is not full, the
procedure inserts the parameter into the queue and updates the relevant pointer(s).
Write program code for Enqueue().
Save your program.
Copy and paste the program code into part 2(a)(ii) in the evidence document.
[4]
(iii)
The function Dequeue() checks if the queue is empty.
If the queue is empty, the function outputs a suitable message and returns the string
"Empty".
If the queue is not empty, the function returns the first element in the queue and updates
the relevant pointer(s).
Write program code for Dequeue().
Save your program.
Copy and paste the program code into part 2(a)(iii) in the evidence document.
[4]
(b) A shop sells computer games. Each game has a unique identifier (ID) of string data type.
The text file QueueData.txt contains a list of game IDs.
The procedure ReadData() reads the data from the text file and inserts each item of data
into the array Queue.
Write program code for the procedure ReadData().
Save your program.
Copy and paste the program code into part 2(b) in the evidence document.
[6]
(c) Some game IDs appear in the text file more than once.
The program needs to total the number of times each game ID appears in the text file.
The record structure RecordData has the following fields:
•
ID — a string to store the game ID
•
Total — an integer to store the total number of times that game ID appears in the text
file.
(i)
Write program code to declare the record structure RecordData.
If you are writing in Python, include attribute declarations as comments.
Save your program.
Copy and paste the program code into part 2(c)(i) in the evidence document.
[2]
(ii)
The global 1D array Records stores up to 50 items of type RecordData.
The global variable NumberRecords stores the number of records currently in the array
Records and is initialised to 0.
Write program code to declare Records and NumberRecords.
If you are writing in Python, include attribute declarations as comments.
Save your program.
Copy and paste the program code into part 2(c)(ii) in the evidence document.
[2]
(iii)
The pseudocode algorithm for the procedure TotalData():
•
uses Dequeue() to remove an ID from the queue
•
checks whether a RecordData with the returned ID exists in Records
•
increments the total for that ID in the record if the ID already exists
•
creates a new record and stores it in Records if the ID does not exist.
PROCEDURE TotalData()
DECLARE DataAccessed : STRING
DECLARE Flag : BOOLEAN
← Dequeue()
DataAccessed
← FALSE
Flag
IF NumberRecords = 0 THEN
← DataAccessed
Records[NumberRecords].ID
Records[NumberRecords].Total ← 1
Flag ← TRUE
NumberRecords ← NumberRecords + 1
ELSE
← 0 TO NumberRecords - 1
FOR X
IF Records[X].ID = DataAccessed THEN
← Records[X].Total + 1
Records[X].Total
← TRUE
Flag
ENDIF
NEXT X
ENDIF
IF Flag = FALSE THEN
← DataAccessed
Records[NumberRecords].ID
Records[NumberRecords].Total ← 1
NumberRecords ← NumberRecords + 1
ENDIF
ENDPROCEDURE
Write program code for the procedure TotalData().
Save your program.
Copy and paste the program code into part 2(c)(iii) in the evidence document.
[5]
(d) The procedure OutputRecords() outputs the ID and total of each record in Records in the
format:
ID
1234
Total
4
Write program code for OutputRecords().
Save your program.
Copy and paste the program code i

Advertisement
104
9618/42/O/N/23 · Question 1Oct/Nov 2023Paper 4227 marks
Loading question…
Question text

1
A program stores lower-case letters in two stacks.
One stack stores vowels (a, e, i, o, u) and one stack stores consonants (letters that are not
vowels).
Each stack is implemented as a 1D array.
(a) (i)
Write program code to declare two 1D global arrays: StackVowel and StackConsonant.
Each array needs to store up to 100 letters. The index of the first element in each array is 0.
If you are writing in Python, include declarations using comments.
Save your program as Question1_N23.
Copy and paste the program code into part 1(a)(i) in the evidence document.
[2]
(ii)
The global variable VowelTop is a pointer that stores the index of the next free space in
StackVowel.
The global variable ConsonantTop is a pointer that stores the index of the next free
space in StackConsonant.
VowelTop and ConsonantTop are both initialised to 0.
Write program code to declare and initialise the two variables.
If you are writing in Python, include declarations using comments.
Save your program.
Copy and paste the program code into part 1(a)(ii) in the evidence document.
[1]
(b) (i)
The procedure PushData() takes one letter as a parameter.
If the parameter is a vowel, it is pushed onto StackVowel and the relevant pointer
updated.
If the stack is full, a suitable message is output.
If the parameter is a consonant, it is pushed onto StackConsonant and the relevant
pointer updated.
If the stack is full, a suitable message is output.
You do not need to validate that the parameter is a letter.
Write program code for PushData().
Save your program.
Copy and paste the program code into part 1(b)(i) in the evidence document.
[6]
(ii)
The file StackData.txt stores 100 lower-case letters.
The procedure ReadData() reads each letter from the file and uses PushData() to
push each letter onto its appropriate stack.
Use appropriate exception handling if the file does not exist.
Write program code for ReadData().
Save your program.
Copy and paste the program code into part 1(b)(ii) in the evidence document.
[6]
(c) The function PopVowel() removes and returns the data at the top of StackVowel and
updates the relevant pointer(s).
The function PopConsonant() removes and returns the data from the top of StackConsonant
and updates the relevant pointer(s).
If either stack is empty, the string "No data" must be returned.
Write program code to declare PopVowel() and PopConsonant().
Save your program.
Copy and paste the program code into part 1(c) in the evidence document.
[5]
(d) The program first needs to call ReadData() and then:
1.
prompt the user to input their choice of vowel or consonant
2.
take, as input, the user’s choice
3.
depending on the user’s choice, call PopVowel() or PopConsonant() and store the
return value.
The three steps are repeated until 5 letters have been successfully returned and stored.
If either stack is empty at any stage, an appropriate message must be output.
Once 5 letters have been successfully returned and stored, they are output on one line, for
example:
abyti
(i)
Write program code for the main program.
Save your program.
Copy and paste the program code into part 1(d)(i) in the evidence document.
[6]
(ii)
Test your program with the following inputs:
vowel
consonant
consonant
vowel
vowel
Take a screenshot of the output.
Save your program.
Copy and paste the screenshot into part 1(d)(ii) in the evidence document.
[1]

105
9618/42/O/N/23 · Question 2Oct/Nov 2023Paper 4217 marks
Loading question…
Question text

2
An integer is said to be divisible by another integer if the result of the division is also an integer.
For example:
10 is divisible by 1, 2, 5 and 10:
•
10 ÷ 1 = 10
•
10 ÷ 2 = 5
•
10 ÷ 5 = 2
•
10 ÷ 10 = 1
10 is not divisible by 4:
•
10 ÷ 4 = 2.5
1, 2, 5 and 10 are said to be the divisors of 10.
The iterative function IterativeCalculate() totals all the divisors of its integer parameter and
returns this total.
Example 1: if the parameter is 10, the total will be 18 (1 + 2 + 5 + 10) .
Example 2: if the parameter is 4, the total will be 7 (1 + 2 + 4) .
A pseudocode algorithm for IterativeCalculate() is shown.
FUNCTION IterativeCalculate(Number : INTEGER) RETURNS INTEGER
DECLARE Total : Integer
DECLARE ToFind : Integer
← Number
ToFind
Total ← 0
WHILE Number <> 0
IF ToFind MODULUS Number = 0 THEN
← Total + Number
Total
ENDIF
← Number - 1
Number
ENDWHILE
RETURN Total
ENDFUNCTION
The operator MODULUS calculates the remainder when one number is divided by another.
(a) (i)
Write program code for IterativeCalculate().
Save your program as Question2_N23.
Copy and paste the program code into part 2(a)(i) in the evidence document.
[5]
(ii)
Write program code to call IterativeCalculate() with 10 as the parameter and
output the return value.
Save your program.
Copy and paste the program code into part 2(a)(ii) in the evidence document.
[2]
(iii)
Test your program.
Take a screenshot of the output.
Save your program.
Copy and paste the screenshot into part 2(a)(iii) in the evidence document.
[1]
(b) IterativeCalculate() has been rewritten as the recursive function RecursiveValue().
A pseudocode algorithm for RecursiveValue() is given. The function is incomplete.
FUNCTION RecursiveValue(Number : INTEGER, ToFind : INTEGER)
RETURNS INTEGER
IF Number = … THEN
RETURN 0
ELSE
IF ToFind … Number = 0 THEN
RETURN … + RecursiveValue(Number - 1, ToFind)
ELSE
… RecursiveValue(Number - 1, … )
ENDIF
ENDIF
ENDFUNCTION
(i)
Write program code for RecursiveValue().
Save your program.
Copy and paste the program code into part 2(b)(i) in the evidence document.
[7]
(ii)
Write program code to call RecursiveValue() with 50 as the first parameter and 50
as the second parameter and output the return value.
Save your program.
Copy and paste the program code into part 2(b)(ii) in the evidence document.
[1]
(iii)
Test your program.
Take a screenshot of the output.
Save your program.
Copy and paste the screenshot into part 2(b)(iii) in the evidence document.
[1]

Advertisement