A Levels Computer Fillable Exam
A Levels Computer Fillable Exam
CANDIDATE
NAME
CENTRE CANDIDATE
NUMBER NUMBER
Write your Centre number, candidate number and name in the spaces at the top of this page.
Write in dark blue or black pen.
You may use an HB pencil for any diagrams, graphs or rough working.
Do not use staples, paper clips, glue or correction fluid.
DO NOT WRITE IN ANY BARCODES.
At the end of the examination, fasten all your work securely together.
The number of marks is given in brackets [ ] at the end of each question or part question.
[1]
[1]
[1]
To make future computation more straightforward Meena retrieves her marks from the file
and stores them in an array, Marks. This array has 30 elements, and marks range from 0
to 100.
(d) State a suitable value to initialise each element of the array. Justify your choice.
Initial value
Reason
[1]
[4]
2 The following algorithm should:
• input ten numbers
• output the largest number input
• output the average value of the input data
10 largest = 0
20 sum = 0
30 for x = 1 to 10
40 input x
60 output largest
70 sum = sum + x
80 next x
90 average = sum * 10
error 1
correction
error 2
correction
error 3
correction
error 4
correction
[4]
3 Study the following flowchart.
START
count = 1
negcount = 0
poscount = 0
neg = 0
pos = 0
zero = 0
INPUT X
Yes negcount =
is X < 0 ? neg = neg + X negcount + 1
No
Yes poscount =
is X > 0 ? pos = pos + X poscount + 1
No
zero = zero + 1
count = count + 1
Yes
is count <=
10 ?
No
negavge = neg/negcount
posavge = pos/poscount
OUTPUT
negavge, STOP
posavge, zero
(d) Write the pseudocode equivalent of the given flowchart.
.. [7]
4 Gina is developing her programming skills in string handling.
She is going to input two strings.
Each string is made up of three parts:
• letters, followed by
• a single ‘*’ character, followed by
• letters
The groups of letters after the ‘*’ characters are joined together to form a new string which
is then output.
For example, with “DFG*COM” and “B*PUTER” as inputs, the new string output will be
“COMPUTER”.
(a) Write pseudocode to perform this task. (Ensure that you use meaningful variable names and
use proper indentation.
[8]
(b) She writes this code as the function JoinStrings because it is to be used several
times.
[2]
(ii) Write the function header in the language you used in part (a).
[2]
[1]
By value
By reference
[4]
5 Liliane wants to write a program to play chess. She will represent the board of 8 x 8
squares, using the 2-dimensional array Board[8,8].
Each element of the array will need initialising to zero. Later, if a chess piece is on a
square, it will take a value of 1.
She starts by writing pseudocode for the initialisation of a 4 x 4 board. This is easier to
trace.
01 RowNo ← 1
02 WHILE RowNo < 4 DO
03 ColumnNo ← 1
04 WHILE ColumnNo < 4 DO
05 Board[RowNo,ColumnNo] ← 0
06 ColumnNo ← ColumnNo + 1
07 ENDWHILE
08 RowNo ← RowNo + 1
09 ENDWHILE
(a) To test this pseudocode she traces it until the first five elements of Board have been
initialised.
Complete the headings and the trace for these first five elements of the array.
Board
RowNo ColumnNo RowNo<4 ColumnNo<4
[1,1]
1 1 True True 0
[5]
(b) There is an error in the pseudocode.
[1]
(c) Rewrite two lines that will make the pseudocode work as intended.
[2]
(d) State the type of loop that would be better for this initialisation. Give an example to show
how it may have been used in the pseudocode
[1]
(e) On a full 8 x 8 board, state the relative positions of the squares Board[1,8] and
Board[8,1] .
[1]
6 A programmer is producing a computer program which allocates seats to customers in
a small theatre.
(a) The code for the program uses variables and constants.
....... [2]
....... [1]
(iii) Describe how using constants can help improve the maintainability of the code.
[2]