1. Go through the following presentation and create the class (with attributes and methods shown). Select "Yes", when complete.
2. Classes are used in Object Orientated Programming. Describe what is meant by a class? (3 mark)
3. One of the pillars of OOP is Inheritance. Desribe what this term means. (3 marks)
4. Name three other features of Object Orientated Programming (not including Inheritance) (3 marks)
5. In the following code snippet, how many attributes can you count? (1 mark)
6. What is the name of the method in the above class definition? (1 mark)
7. Write a line of code that creates a new instance of Child (called mychild1) for a child with age 11 named "Joseph" (1 mark)
Assume you have a class called 'Child' with the required constructor attributes of 'name' and 'age'
8. What is happening on line 1 of this program (class Teeanger(Child) (2 marks)
9. Discuss the advantages and disadvantages to the team of developers of using OOP over procedural programming. You should refer to inheritance, encapsulation and polymorphism in your answer.(6 marks)
A software development company is building an operating
system for a mobile phone that is in the process of being
The code is written using an object-oriented programming
(OOP) language. In one past paper (OCR) this is a 9 mark question.
10. Analyse the code below. What is happening on the second last line? (1 mark)
11. Referring to the previous question and the code snippet. What is the output of the last line? callum.isHappy? (1 mark)
12. Analyse the following code. You'll notice that the object callum has been created based on the Teenager class. What is the output of callum.isSad()? (1 mark)
13. Explain the difference between a HTML id attribute and a HTML class attribute. (2 marks)
14. Inheritance is when a class takes on the methods and attributes of a parent class. The inheriting class may ______ some of these methods / attributes and may have additional extra methods and attributes of its own.
15. ______________ is the process of keeping an object's attributes private so they can only be accessed and changed via public methods. Polymorphism means that objects of different types can be treated in the same way. (2 marks)