Question 4

OCR Computer Science Specimen Paper 1A level12 marks

On the specification

(a)
2.2 Problem solving and programming
(b)
2.2 Problem solving and programming
(c)(i)
2.2 Problem solving and programming
(c)(ii)
2.2 Problem solving and programming
(d)
1.2 Software and software development
Question text

4 Livid Lizards is a computer game in which players get to fire lizards from a cannon to knock down walls. Players get to pick different types of lizards, each with qualities and special powers. The game is coded using an object-oriented language. Below is the code for the lizard class: class Lizard private speed private mass private size public procedure new(givenSpeed, givenMass, givenSize) speed=givenSpeed mass=givenMass size=givenSize endprocedure public function breakBlock(brick) if speed*mass>=brick.getStrength() then speed=((speed*mass)-brick.getStrength())/mass; return true else return false endif endfunction endclass (a) Lizard is a class. Describe what is meant by a class. [2] (b) Identify an attribute in the Lizard class. [1] (c) (i) Describe what is meant by the term inheritance. [3] (ii) Explain one way the game’s developers might use inheritance for Livid Lizards. [3] (d) The game uses a 2D graphics library. Explain why a linker would need to be used after compilation. [3]