Note AcademyNote Academy

Computer Science (AS & A Level) · Oct / Nov 2022 · Paper 43 · Question 2

9618

As printed in the paper

The question as text

A computer program is being developed that uses a set of cards. The program is written using object-oriented programming. The program has two classes: Card and Hand. The methods and attributes of these classes are shown: Card Number : INTEGER Colour : STRING stores the card number from 1 to 5 inclusive stores the card colour: red, blue or yellow Constructor() GetNumber() GetColour() takes a number and colour as parameters and sets the private values to these parameters returns the card number returns the card colour Hand Cards : ARRAY[0:9] OF Card FirstCard : INTEGER NumberCards : INTEGER 1D array of type Card stores the position of the first card in the hand stores the number of cards in the hand Constructor() GetCard() takes five card objects as parameters, assigns each card to the array Cards[], initialises FirstCard to 0 and NumberCards to 5 takes an index as a parameter and returns the card at that index in the array

Read automatically from the paper; the printed page above is exact.

Show the answer and mark scheme
  • 2(a)(i)[5]

  • 2(a)(ii)[3]

  • 2(a)(iii)[2]

  • 2(b)(i)[6]

  • 2(b)(ii)[2]

  • 2(b)(iii)[2]

  • 2(c)(i)[6]

  • 2(c)(ii)[4]

  • 2(c)(iii)[1]

Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.