Question 4(b) 2014 · October-November · Paper 21 · 35 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (b)
Part (b)
NumberOFWhiteTiles 0
Show text version of question
Question 4
Part (b)
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.
Part (b)
Ali uses a sequential file of records to store the user IDs and encrypted passwords.
When a user types in their User ID, the program calls a function, FindPassword, with parameter ThisUserID.
The function searches each record in the file for ThisUserID and returns the encrypted password.
If ThisUserID is not stored in the file, the function returns an error code.
Complete the pseudocode:
FUNCTION FindPassword(ThisUserID : STRING) RETURNS ................. DECLARE Found : BOOLEAN OPENFILE FOR INPUT // for reading Found ← FALSE
WHILE ........................................................... FILEREAD next record
IF ............................................................ THEN
......................................................... ENDIF ENDWHILE
IF .............................................................. THEN
........................................................... ELSE
........................................................... ENDIF CLOSEFILE ENDFUNCTION
Question 8
3 Ahmed runs his own business. He lays floor tiles in rooms for customers. Ahmed wants a program that calculates how many tiles he needs when he inputs the measurements of the length and width of the room he is working on.
Part (a)
(i)
Draw a screen design that is suitable for the following:
- to enter the length of the room in cm
- to enter the width of the room in cm
- to display the number of tiles required.
(ii)
Explain how Ahmed can enter the data using your screen design in part (i).
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[1]
Part (b)
The width of a room will measure at least 100 cm and less than 1000 cm.
The program must validate the width input.
Write a logic expression that is TRUE when the width stored in the variable RoomWidth is within the expected range.
...................................................................................................................................................
...............................................................................................................................................[3]
Question 9
Why this question appears here
72% assigned-topic match · Data types and structures › Data types and records
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_21.pdf
