Preview

01-Object Orientated Programming

 1. Python is NOT an object orientated language.

  False

  True

 2. Object Orientated programming ...
#Example of Object Orientated code - use of classes
class Person:
    def __init__(self, name):
        self.name = name

    def say_hi(self):
        print('Hello, my name is', self.name)

p = Person('Mr Joey Bloggs')
p.say_hi()

  allows for the use of inheritance and capsule hunting which utilises classes

  allows for the creation of objects that can be directly manipulated by the cache

  allows for the use of polymorphism where objects hide data and methods at all times

  allows for the use of classes and objects combine methods and data(attributes)

 3. The OOP approach differs from the procedural approach in that ...

  Procedural programming languages separate data and code.

  Procedural programming languages do not separate data and code

  Procedural programming languages are much slower to use

  Procedural programming languages use classes and morphs

 4. In OOP, the programmer can use classes. A class ...

  acts as a template for an object. It contains shared attributes and methods.

  acts as a function that keeps all the functions inside it hidden from anyone

  acts as a 'school' in which there are many classes

  acts as a blueprint which is completely empty, containing no attributes and methods

 5. The concept of OOP revolves around the idea of the world we live in with objects. The OOP definition of an object is:

  an object is an individual instance of a class.

  an object is a class orientated world template

  an object is an instance of a function

  an object is a mini class that exists within a class

 6. Object-oriented programming allows for simplified programming. Its benefits include ...

  hard coded solutions, attributes and methods kept contained, object instances

  the ability to keep code separate from itself, i.e non reusability

  reusability, refactoring, extensibility, maintenance and efficiency.

  instantiation, creation of objects from functions, quick processing

 7. There are four pillars of OOP (features of OOP that are widely used). One of them is 'Abstraction'. Which of the following is NOT a feature of OOP?

  inheritance

  polymorphism

  encapsulation

  validation

 8. Generally speaking, OOP has been the programming model of choice for the last decade or more. OOP's modular design enables programmers to build software in manageable chunks rather than in large amounts of sequential code

  True

  False

 9. Which of the following is NOT a benefit of OOP:

  scalability -with objects and definitions having no finite limitation

  separation of data from method

  non-reusability - classes are hidden so they cannot be reused

  re-usability of code and ease of testing

 10. OOP promotes a way of programming that allows programmers to think in terms of Objects

  True

  False