Skip to main content
A-LevelComputer ScienceFurther programming9618/41 · Oct/Nov 2023 · Q324 Marks

A computer game is written using object-oriented programming. The game has multiple characters that can move around the screen. The class Character stores data about the characters. Each character has a name, a current X (horizontal) position and a current Y (vertical) position. [Figure X.X] Character Name : STRING stores the name of the character as a string XPosition : INTEGER stores the X position as an integer YPosition : INTEGER stores the Y position as an integer Constructor() initialises Name, XPosition and YPosition to its parameter values GetXPosition() returns the X position GetYPosition() returns the Y position SetXPosition() adds the parameter to the X position validates that the new X position is between 0 and 10000 inclusive SetYPosition() adds the parameter to the Y position validates that the new Y position is between 0 and 10000 inclusive Move() takes a direction as a parameter and calls either SetXPosition or SetYPosition with an integer value

  1. (a)(i)Write program code to declare the class Character and its constructor. Do not declare the other methods. Use your programming language's appropriate constructor. If you are writing in Python, include attribute declarations using comments. Save your program as Question3_N23. Copy and paste the program code into part 3(a)(i) in the evidence document.[4]
  2. (a)(ii)The get methods GetXPosition() and GetYPosition() each return the relevant attribute. Write program code for the get methods. Save your program. Copy and paste the program code into part 3(a)(ii) in the evidence document.[3]
  3. (a)(iii)The set methods SetXPosition() and SetYPosition() each take a value as a parameter and add this to the current X or Y position. If the new value exceeds 10000, it is limited to 10000. If the new value is below 0, it is limited to 0. Write program code for the set methods. Save your program. Copy and paste the program code into part 3(a)(iii) in the evidence document.[4]
  4. (a)(iv)The method Move () takes a string parameter: "up","down","left" or "right". The table shows the change each direction will make to the X or Y position. Direction Value change up Y position + 10 down Y position – 10 left X position – 10 right X position + 10 Use the appropriate method to change the position value. Write program code for Move(). Save your program. Copy and paste the program code into part 3(a)(iv) in the evidence document.[4]
  5. (b)Write program code to declare a new instance of Character with the identifier Jack. The starting X position is 50 and the starting Y position is 50, the character's name is Jack. Save your program. Copy and paste the program code into part 3(b) in the evidence document.[2]
  6. (c)(i)The class BikeCharacter inherits from the class Character. [Figure X.X] BikeCharacter Constructor() takes Name, XPosition and YPosition as parameters calls its parent class constructor with the appropriate values Move () overrides the method Move () from the parent class by changing either the X position or the Y position by 20 instead of 10 Write program code to declare the class BikeCharacter and its constructor. Do not declare the other method. Use your programming language's appropriate constructor. If you are writing in Python, include attribute declarations using comments. Save your program. Copy and paste the program code into part 3(c)(i) in the evidence document.[3]
  7. (c)(ii)The method Move () overrides the method from the parent class. The table shows the change each direction will make to the X or Y position. Direction Value change up Y position + 20 down Y position – 20 left X position – 20 right X position + 20 Write program code for Move(). Save your program. Copy and paste the program code into part 3(c)(ii) in the evidence document.[2]
  8. (d)Write program code to declare a new instance of BikeCharacter with the identifier Karla. The starting X position is 100, the starting Y position is 50 and the character's name is Karla. Save your program. Copy and paste the program code into part 3(d) in the evidence document.[1]
  9. (e)(i)Write program code to: • take as input which of the two characters the user would like to move • take as input the direction the user would like the character to move • call the appropriate method to move the character • output the character's new X and Y position in an appropriate format, for example: "Karla's new position is X = 100 Y = 200" All inputs require appropriate prompts and must be validated. Save your program. Copy and paste the program code into part 3(e)(i) in the evidence document.[5]
  10. (e)(ii)Test your program twice with the following inputs. Test 1: jack right Test 2: karla down Take a screenshot of the output. Save your program. Copy and paste the screenshot into part 3(e)(ii) in the evidence document.[2]

This question uses a diagram from the original paper, which isn't shown here. Open the full paper from the past papers archive to see it.

Mark scheme

Marking points from the official mark scheme (Oct/Nov 2023). The mark or mark type is shown in brackets.

  1. [4] One mark each to max 4
  2. • Class header (and end where appropriate)
  3. • Three attributes with correct names and data types
  4. • Constructor header (and end where appropriate) with 3 parameters
  5. • Within constructor, assigns attributes to parameters
  6. [3] One mark each
  7. • 1 get header with no parameter ...
  8. • ... returning correct value
  9. • 2nd get method
  10. [4] One mark each to max 4
  11. • 1 set method header (and end where appropriate) with parameter
  12. • adding parameter to X/Y Position attribute and storing in the X/Y attribute
  13. • If (resulting value is) more than 10 000 limiting to 10 000 and if less than 0 limiting to 0
  14. • Second correct set method
  15. [4] One mark each
  16. • Method header with (string) parameter
  17. • Checking parameter for direction ...
  18. • ... using SetYPosition() and SetXPosition() correctly ...
  19. • ... with correct parameters
  20. [2] One mark each
  21. • New instance of Character created with identifier Jack ...
  22. • ... correct constructor called and values passed
  23. [3] One mark each
  24. • Class header inheriting from Character
  25. • Constructor taking all 3 parameters ...
  26. • ... calling parent/super constructor with the 3 parameters
  27. [2] One mark each
  28. • Method header taking parameter and overriding parent/super Move ()
  29. • Correct changes to method to update values by 20
  30. [1] One mark each
  31. • Declaring new BikeCharacter with correct values e.g.
  32. [5] One mark each to max 5
  33. • Reading in both values (character and direction) with appropriate prompts
  34. • Character name is validated as e.g. Jack/Karla, and direction is validated as e.g. up/down/left/right
  35. • Calling Move () for the character input, with direction input as a parameter
  36. • Outputting character's new X and Y position in a suitable format ...
  37. • ... using get methods
  38. [2] One mark for each test

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Further programming, A-Level Computer Science (syllabus 9618). Structured question, 24 marks.
Source
A-Level Computer Science, Oct/Nov 2023 Paper 4 Variant 1, question 3.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep