Past-paper question · 2019 May-June · Paper 43 · Q2(d)(iv)

Question 2(d)(iv) 2019 · May-June · Paper 43 · 5 marks

Original past-paper question for 2(D)(IV)
Original past-paper question for 2(D)(IV)
Original past-paper question for 2(D)(IV)
Original past-paper question for 2(D)(IV)
Original past-paper question for 2(D)(IV)
Original past-paper question for 2(D)(IV)
Reveal official mark-scheme answer

Official answer for Question 2

Part (d)

(iv)

Question 1

mark per bullet point

Question 5

✓
•
✓
Function header and close (where appropriate) and takes ScoreInput as
✓
parameter
✓
•
✓
Check if 0 <= ScoreInput <= 150
✓
•
✓
«if valid, set Score to parameter
✓
•
✓
«if not valid, output error
✓
•
✓
Returns TRUE if valid and returns FALSE if not valid
✓
PYTHON
✓
def __SetScore(ScoreInput):
✓
if ScoreInput >=0 and ScoreInput <=150:
✓
IsValid = True
✓
self__Score = ScoreInput
✓
else:
✓
print("Error")
✓
IsValid = False
✓
Return(IsValid)
✓
PASCAL
✓
function Player.SetScore(ScoreInput: Integer) : Boolean;
✓
begin
✓
If (ScoreInput >=0) AND (ScoreInput <=150) Then
✓
IsValid := True;
✓
result := ScoreInput;
✓
Else
✓
WriteLn('Error')
✓
result := False;
✓
end;
✓
VB
✓
Public Function SetScore(ByVal ScoreInput As Integer) As
✓
Boolean
✓
If (ScoreInput >=0) And (ScoreInput <=150) Then
✓
Return True
✓
Score = ScoreInput
✓
Else
✓
Console.Writeline("Error")
✓
Return False
✓
End If
✓
End Function
✓
9608/43
✓
Cambridge International AS/A Level – Mark Scheme
✓
May/June 2019
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_s19_ms_43.pdf →

Show text version of question

Question 2

Part (d)

(iv)

Question 2

A computer games club wants to run a competition. The club needs a system to store the scores

achieved in the competition.

A
selection of score data is as follows:

Players complete one game to place them into a category for the competition. The games club wants to implement a program to place players into the correct category. The programmer has decided to use object-oriented programming (OOP).

The highest score that can be achieved in the game is 150. Any score less than 50 will not qualify for the competition. Players will be placed in a category based on their score.

The following diagram shows the design for the class Player. This includes the properties and methods.

Player Score : INTEGER // initialised to 0 Category : STRING // "Beginner", "Intermediate", // "Advanced" or "Not Qualified", initialised // to "Not Qualified" PlayerID : STRING // initialised with the parameter InputPlayerID

Create() // method to create and initialise an object using // language-appropriate constructor SetScore() // checks that the Score parameter has a valid value // if so, assigns it to Score SetCategory() // sets Category based on player’s Score SetPlayerID() // allows a player to change their PlayerID // validates the new PlayerID GetScore() // returns Score GetCategory() // returns Category GetPlayerID() // returns PlayerID

Question 9

(iv)

The method SetScore()checks that its INTEGER parameter ScoreInput is valid. If

it is valid, it is then set as Score. A valid ScoreInput is greater than or equal to 0 and less than or equal to 150.

If the ScoreInput is valid, the method sets Score and returns TRUE.

If the ScoreInput is not valid, the method does not set Score, displays an error message, and it returns FALSE.

Write program code for SetScore(ScoreInput : INTEGER).

Programming language .....................................................................................................

Program code

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.....................................................................................................................................

[5]

Question 13

Topic relevance

Why this question appears here

98% assigned-topic match · Further programming › Programming paradigms

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_s19_qp_43.pdf

Keep practising this topic