Question 4(c)(iii) 2014 · October-November · Paper 23 · 36 marks
Question 4
Part (c)
(iii)
Question 4
Swimming \\\\\\
She designs two procedures OutputTallyChart and OutputTally.
OutputTallyChart outputs the first two columns of the tally chart and then calls OutputTally to output the correct number of bars (\).
Complete the pseudocode:
PROCEDURE OutputTallyChart OUTPUT "1 Cricket "
OutputTally(.......................................) OUTPUT "2 Football "
OutputTally(.......................................) OUTPUT "3 Tennis "
OutputTally(.......................................) OUTPUT "4 Swimming "
OutputTally(.......................................) ENDPROCEDURE
PROCEDURE OutputTally(SportCount : INTEGER)
IF ....................................... // check there are bars // to output THEN ....................................... OUTPUT '\' ....................................... ENDIF
....................................... ENDPROCEDURE
Question 5
Part (d)
Rema wants to test each module before she tests the whole program.
The first module she is going to test is the OutputTally procedure using different parameter values.
Give three different types of test data with an example of each.
Justify your choices.
Type of test data Example test data Justification
Part (e)
(i)
All programs should be maintainable. Rema has followed good practice in writing her
pseudocode. She used some features of maintainable programs.
List three such features.
1 .........................................................................................................................................
...........................................................................................................................................
2 .........................................................................................................................................
...........................................................................................................................................
3 .........................................................................................................................................
.......................................................................................................................................[3]
(ii)
Give one further feature that Rema has not used in her solution so far.
...........................................................................................................................................
.......................................................................................................................................[1]
Question 6
2 Ali sets up user IDs and passwords for his program.
When the user types in their user ID, the program looks up the stored password for this user ID.
The stored password is the encrypted version of the user’s password. Ali is going to write the program for Ahmed. The size of one floor tile is 30 cm × 30 cm. Ali knows that the following calculations are required:
TilesForWidth ← RoomWidth DIV 30 TilesForLength ← RoomLength DIV 30 TilesRequired ← TilesForWidth * TilesForLength
(iii)
Ahmed wants the program to add an extra 10% to the number of tiles required in case
any tiles get broken during the work.
In a high-level language, write programming statements to calculate the total number of tiles required, TilesRequired, after the values for RoomLength and RoomWidth have been input and validated.
Language ...........................................................................................................................
Code ..................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[5]
Question 10
4 Ahmed combines white tiles with tiles of one other colour to make a pattern. He draws a design. Here is one example:
Ahmed wants a program to calculate how many tiles he needs of each colour.
Part (a)
Ali stores the design in a 2-dimensional array, FloorDesign. The length and width of the
room will be no more than 35 tiles each.
(i)
Suggest a value Ali should use to represent the white and coloured tiles.
White tile ...........................................................................................................................
Coloured tile ..................................................................................................................[1]
(ii)
Initially, every tile should be white.
In a high-level language, write statements to declare the array FloorDesign and initialise it.
Language ...........................................................................................................................
Code ..................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[5]
Question 11
Part (b)
Ali stores a design of size 15 tiles by 10 tiles in array FloorDesign.
Using pseudocode or a flowchart, show the algorithm to calculate the number of white tiles and the number of coloured tiles in the design.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[6]
Question 12
Reveal official mark-scheme answer
The answer for this question is in the official mark scheme: open the mark scheme.
Why this question appears here
82% assigned-topic match · Algorithm design and problem-solving › Algorithms
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9691_w14_qp_23.pdf
