Past-paper question · 2024 October-November · Paper 41 · Q2(b)(i)

Question 2(b)(i) 2024 · October-November · Paper 41 · 5 marks

Original past-paper question for 2(B)(I)
Original past-paper question for 2(B)(I)
Original past-paper question for 2(B)(I)
Reveal official mark-scheme answer Official mark-scheme answer for 2(B)(I)

Official answer for Question 2

Part (b)

(i)

Question 1

mark each

Question 5

  • Instantiating one object of type Horse with correct data …
  • … and storing in first element of a 1D array Horses
  • Instantiating second object of type Horse with correct data and storing in second index of the array
  • Outputting name of both horse objects from array …
  • … using GetName()
✓
e.g.
✓
Python
✓
Horses = []
✓
Horses.append(Horse("Beauty", 150, 72))
✓
Horses.append(Horse("Jet", 160, 65))
✓
print(Horses[0].GetName())
✓
print(Horses[1].GetName())
✓
VB.NET
✓
Dim Horses(2) As Horse
✓
Horses(0) = New Horse("Beauty", 150, 72)
✓
Horses(1) = New Horse("Jet", 160, 65)
✓
Console.WriteLine(Horses(0).GetName())
✓
Console.WriteLine(Horses(1).GetName())
✓
Cambridge International AS & A Level – Mark Scheme
✓
9618/41
✓
October/November 2024
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9618_w24_ms_41.pdf →

Show text version of question

Question 2

Part (b)

(i)

Question 2

A computer program is designed to simulate horses doing show jumping. In show jumping, horses

jump over obstacles called fences. A horse successfully jumps a fence if it does not knock the fence down.

The program is written using Object-Oriented Programming (OOP).

The class Horse stores data about the horses.

Horse

Name : STRING stores the name given to the horse

MaxFenceHeight : INTEGER stores the maximum height in cm that the horse can jump, for example 132

PercentageSuccess : INTEGER stores the percentage chance of a horse not knocking down a fence, for example 70 represents a 70% chance of jumping a fence successfully Constructor() initialises Name, MaxFenceHeight and PercentageSuccess to its parameter values

GetName() returns the name of the horse

GetMaxFenceHeight() returns the maximum height the horse can jump

Success() calculates and returns the percentage chance of a horse successfully jumping a specific fence The array Horses stores objects of type Horse.

(i)

The program has two horses:

  • The horse named ‘Beauty’ can jump a maximum height of 150 cm and has a success
  • percentage rate of 72%.

  • The horse named ‘Jet’ can jump a maximum height of 160 cm and has a success

percentage rate of 65%.

Write program code to:

  • declare the array, Horses, local to the main program with space for two Horse
  • objects

  • store the two horses described in the array
  • output the name of both Horse objects from the array.

Save your program.

Copy and paste the program code into part 2(b)(i) in the evidence document.

[5]
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 9618_w24_qp_41.pdf

Keep practising this topic