Return to home page

Python Quiz: Module 6

List of Objects: Object Oriented Programming


  1. What is OOP encapsulation?

  2. What is OOP polymorphism?

  3. What is OOP abstraction?

  4. What is OOP inheritance?

  5. Which of the following might be an instruction to instantiate a Shape object?

  6. The following code defines an class that creates a bank account. Which code snippet instantiates a bank account object?

    
    class Person: 
        def init(self, first_name,last_name): 
            self.first_name = first_name 
            self.last_name = last_name     
    @staticmethod def print_grinning_face: print("\U0001F606")
    
    class Bank_Account(Person): 
        def init(self, first_name, last_name, account_number, balance): 
            super().init(first_name,last_name) 
            self.account_number = account_number 
            self.balance = balance 
    def deposit(self,amount): self.balance += amount
    def withdrawal(self,amount): self.balance -= amount
    @staticmethod def advice(): print("Save for a rainy day")

  7. Which of the following are examples of instance methods in the code above?

  8. Which of the following are examples of static methods in the Bank Account code?

  9. Which of the following are NOT properties in the Bank Account code?

  10. When a subclass overrides a parent class method, which of the following characteristics does it have?

  11. When a subclass overloads a parent class method, which of the following characteristics does it have?