Past-paper question · 2018 October-November · Paper 41 · Q5(d)

Question 5(d) 2018 · October-November · Paper 41 · 2 marks

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

Official answer for Question 5

Part (d)

Question 1

mark per bullet point to max 2:

Question 2

✓
•
✓
Assigning to OneS and correct instantiation
✓
•
✓
Correct parameter values
✓
Examples:
✓
Python
✓
OneS = Cards(1, "square")
✓
VB.NET
✓
Dim OneS As New Cards(1, "square")
✓
or
✓
Dim OneS As Cards = New Cards(1, "square")
✓
or
✓
OneS = New Cards(1, "square")
✓
Pascal
✓
var OneS : Cards;
✓
OneS := Cards.Create(1, "square")

Mark scheme 9608_w18_ms_41.pdf →

Show text version of question

Question 5

Part (d)

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 (d)

A card, OneS, has the value 1 for Number and the value "square" for Shape.

Write program code to instantiate an instance of Cards for OneS.

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

Program code

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

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

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

[2]

Question 16

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

Keep practising this topic