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

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

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

Official answer for Question 5

Part (a)

Question 1

mark per bullet point to max 2:

Question 2

✓
•
✓
To restrict direct access to the property to the class // keep the properties secure // So the data can only be accessed
✓
by its methods // makes the program more robust
✓
•
✓
To make the program easier to debug
✓
•
✓
To ensure data going in is valid // to stop invalid changes // stop accidental changes
✓
9608/41
✓
Cambridge International AS/A Level – Mark Scheme
✓
October/November 2018
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_w18_ms_41.pdf →

Show text version of question

Question 5

Part (a)

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

Explain why the properties are private.

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

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

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

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

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

[2]

Question 15

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