Past-paper question · 2018 October-November · Paper 43 · Q5(c)

Question 5(c) 2018 · October-November · Paper 43 · 2 marks

Original past-paper question for 5(C)
Original past-paper question for 5(C)
Original past-paper question for 5(C)
Reveal official mark-scheme answer Official mark-scheme answer for 5(C)

Official answer for Question 5

Part (c)

Question 1

mark per bullet point to max 2:

Question 2

✓
•
✓
Function declaration for GetNumber
✓
•
✓
Returning Number
✓
Examples:
✓
Python
✓
def GetNumber():
✓
return(self.__Number)
✓
VB.NET
✓
Public Function GetNumber() As Integer
✓
Return(Number)
✓
End Function
✓
Pascal
✓
function Cards.GetNumber() : Integer;
✓
begin
✓
GetNumber := Number;
✓
end;
✓
9608/43
✓
Cambridge International AS/A Level – Mark Scheme
✓
October/November 2018
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_w18_ms_43.pdf →

Show text version of question

Question 5

Part (c)

Question 5

A game uses a set of cards. Each card has a number (between 0 and 9 inclusive) and a shape

("square", "triangle" or "circle").

The game is written using object-oriented programming.

The class, Cards, has the private properties:

  • Number
  • Shape

and the methods:

  • Constructor()
  • GetNumber()
  • GetShape()

The purpose of each method in the class Cards is given in the following table.

Method Purpose Constructor() Takes a number and a shape as parameters Checks that the number and the shape are valid and:

  • either assigns the parameters to Number and Shape
  • or reports an error.

GetNumber() A public method that returns the number for that card. GetShape() A public method that returns the shape for that card.

Part (c)

Write program code for the GetNumber() method.

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

Program code

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

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

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

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

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

[2]
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_w18_qp_43.pdf

Keep practising this topic