💻
Programming Medium

Object-Oriented Programming

Classes, inheritance, polymorphism and OOP concepts at medium difficulty!

15 Questions
30s Per Question
0+ Plays
← All Programming Quizzes 📚 Study Guide for this category →
💡 Create account to save scores & earn XP
📋 View All 15 Questions & Answers

1. What is method overriding?

  • A. Creating a new method
  • B. Calling a parent method
  • C. Deleting a method
  • D. Redefining a parent class method in a child class ✓

💡 Method overriding allows a child class to provide its own implementation of a method already defined in its parent class.

2. What is a constructor?

  • A. A method that deletes an object
  • B. A method that copies an object
  • C. A special method called when an object is created ✓
  • D. A method that sorts objects

💡 A constructor is a special method automatically called when an object is instantiated to initialize its attributes.

3. What is "inheritance" in OOP?

  • A. Hiding implementation details
  • B. A class acquiring properties and methods of another class ✓
  • C. Creating multiple objects
  • D. Overloading a function

💡 Inheritance allows a child class to acquire the properties and methods of a parent class, promoting code reuse.

4. What is "composition" in OOP?

  • A. A type of inheritance
  • B. Building complex objects by combining simpler objects ✓
  • C. A type of polymorphism
  • D. A type of encapsulation

💡 Composition builds complex objects by including instances of other classes as attributes — "has-a" relationship.

5. What is "polymorphism" in OOP?

  • A. A class with many attributes
  • B. The ability of different objects to respond to the same method differently ✓
  • C. Creating multiple classes
  • D. A type of encapsulation

💡 Polymorphism allows different objects to respond to the same method call in their own way — same interface, different behavior.

6. What is a "class" in OOP?

  • A. A function
  • B. A variable
  • C. A blueprint for creating objects ✓
  • D. A type of loop

💡 A class is a blueprint or template that defines the attributes and methods that objects of that type will have.

7. What does the "private" access modifier do?

  • A. Makes a member accessible everywhere
  • B. Makes a member accessible only within the same class ✓
  • C. Makes a member accessible in subclasses
  • D. Makes a member accessible in the same package

💡 Private members are only accessible within the class they are defined in — not from outside or subclasses.

8. What is "multiple inheritance"?

  • A. A class with many methods
  • B. A class inheriting from more than one parent class ✓
  • C. Creating multiple objects
  • D. Overriding multiple methods

💡 Multiple inheritance allows a class to inherit from more than one parent class. Supported in Python but not Java.

9. What is an "abstract class"?

  • A. A class with no methods
  • B. A class that cannot be instantiated and may have abstract methods ✓
  • C. A class with only static methods
  • D. A class with private methods

💡 An abstract class cannot be instantiated directly and may contain abstract methods that subclasses must implement.

10. What is an "interface" in OOP?

  • A. A type of class with implementation
  • B. A visual user interface
  • C. A contract specifying methods a class must implement ✓
  • D. A type of variable

💡 An interface defines a contract — a set of methods that any implementing class must provide its own implementation for.

11. What is "method overloading"?

  • A. Overriding a parent method
  • B. Deleting a method
  • C. Multiple methods with the same name but different parameters ✓
  • D. Calling a method multiple times

💡 Method overloading allows multiple methods with the same name but different parameter lists in the same class.

12. What is "abstraction" in OOP?

  • A. Showing all implementation details
  • B. Inheriting from multiple classes
  • C. Hiding complex implementation and showing only necessary features ✓
  • D. Creating multiple objects

💡 Abstraction hides complex implementation details and exposes only the essential features of an object.

13. What is "encapsulation" in OOP?

  • A. Inheriting from a parent class
  • B. Bundling data and methods together and restricting access ✓
  • C. Creating multiple instances
  • D. Overriding a method

💡 Encapsulation bundles data (attributes) and methods together inside a class and restricts direct access from outside.

14. What does "super()" do in OOP?

  • A. Deletes the parent class
  • B. Creates a new class
  • C. Calls a method from the child class
  • D. Calls a method or constructor from the parent class ✓

💡 super() is used to call a method or constructor from the parent (super) class within a child class.

15. What is a "static" method in OOP?

  • A. A method that changes frequently
  • B. A method that belongs to the class rather than any object instance ✓
  • C. A method that is private
  • D. A method that calls itself

💡 A static method belongs to the class itself, not to instances. It can be called without creating an object.

More Programming Quizzes

View all Programming quizzes →