Question 4(a) 2014 · October-November · Paper 21 · 28 marks
Reveal official mark-scheme answer
The answer for this question is in the official mark scheme: open the mark scheme.
Show text version of question
Question 4
Part (a)
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 (a)
The program calls the function PasswordCheck with the stored password as parameter.
If the user enters the correct password the function returns the value TRUE.
Each time the password is entered incorrectly, the message “Wrong password” is output.
If the user enters an incorrect password 3 times, the user is told that access is denied, and the function returns the value FALSE.
Complete the flowchart using the given statements. Ensure that only statement numbers are present on the flowchart.
FUNCTION PasswordCheck(StoredPassword)
Statement Statement number 1 OUTPUT “Wrong password” 2 OUTPUT “Access denied” 3 INPUT Password OUTPUT 4 RETURN TRUE “Enter password” 5 is NumberOfTries > 2 ? 6 is StoredPassword = Encrypted Password ? 7 NumberOfTries ← 0 8 NumberOfTries ← NumberOfTries + 1 9 Encrypt password
No
No
Yes Yes
RETURN FALSE
ENDFUNCTION
Question 7
Why this question appears here
82% assigned-topic match · Programming › Structured programming
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
