Cards (23)

  • What does Object Oriented Programming (OOP) focus on?
    Classes and objects
  • What is a class in OOP?
    A template for a set of objects
  • What do objects in OOP have?
    State and behaviour
  • What is an object in OOP?
    An instance of a class
  • What does an object hold?
    Attributes and methods
  • What is an attribute in OOP?
    A variable attached to a class
  • What is a method in OOP?
    A piece of code that performs an action
  • Which method would you use to get an object's name?
    getName()
  • What does inheritance allow in OOP?
    A derived class inherits attributes from superclass
  • What is a derived class?
    A class that inherits from a superclass
  • What does a derived class have in addition to inherited attributes?
    Its own attributes and methods
  • What does the constructor method do?
    Creates a new object and sets attributes
  • How do you create a new Monster object?
    monsterOne = new Monster(true, 5, "Boris")
  • What does the method monsterOne.eat() output?
    Boris eats a hero.
  • What is polymorphism in OOP?
    Same method behaves differently in classes
  • What is encapsulation in OOP?
    Data hiding and access through methods
  • What is a benefit of encapsulation?
    Reduces errors and maintains data integrity
  • How does OOP differ from procedural programming?
    OOP defines objects as independent entities
  • How can OOP improve code maintenance?
    Classes can be modified or extended easily
  • What is a key advantage of using OOP for queues?
    Multiple instances can be created easily
  • Why is OOP considered more secure than procedural programming?
    Access to attributes can be restricted
  • What are the advantages of using an object-oriented paradigm?
    • Code can easily be reused
    • Classes can be used in other programs
    • Inheritance extends existing classes
    • Easier to maintain and modify classes
    • Debugging is simplified through encapsulation
    • Code security is enhanced by restricting access
    • Better for team collaboration with distributed classes
  • Compare procedural programming and OOP for implementing a queue.
    Knowledge:
    • OOP defines objects as independent entities
    • Attributes can be private to restrict changes

    Application:
    • OOP allows object creation from the queue
    • Procedural requires individual queue declarations

    Evaluation:
    • OOP reduces code redundancy and errors
    • Procedural needs careful value passing and global variables