Question 1(c) 2016 · October-November · Paper 22 · 3 marks
Reveal official mark-scheme answer
Official answer for Question 1
Part (c)
Part (c)
INPUT PlayerGameGrade
Show text version of question
Question 1
Part (c)
Question 1
A number of players take part in a competition. The competition consists of a number of games.
Each game is between two players. The outcome of a game is that each player is awarded a grade (A, B, C or D). Each grade has an associated number of points as shown in the table below.
Grade Points
The points total for all players is recorded. After each game is completed, the total number of points for each player is updated.
For example:
- before the game between Ryan and Karina, Ryan’s total is 5 points and Karina’s total is 3 points
- the result of the game between Ryan and Karina is: Ryan achieved grade B, Karina achieved
- the players’ points totals are updated to: Ryan has 6 and Karina has 8
grade D
When a player’s points total reaches 12 or higher, that player is removed from the competition.
The program will output:
- the player’s updated points total
- the message ‘ELIMINATED’ if the player is removed from the competition.
The programmer designs the identifier table below:
Identifier Data type Description PlayerName STRING Name of the player PlayerGameGrade CHAR Game grade for the player PointsTotal INTEGER Current player points Procedure has parameters SavePlayerTotal procedure PlayerName and PointsTotal and saves the updated player total Function has a parameter ReadPlayerTotal function PlayerName and returns the current total for that player
Part (c)
The programmer amends the design to validate the value of player game grade that the user
inputs.
The amended part of the flowchart is shown below.
Loop
OUPUT INPUT "Invalid – Re-enter" PlayerGameGrade
Is No PlayerGameGrade = 'A' or 'B' or 'C' or 'D'?
Yes
Question 5
Write the equivalent pseudocode using a pre-condition loop, for this part of the amended flowchart.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
..............................................................................................................................................
Why this question appears here
71% 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 9608_w16_qp_22.pdf
