💻
Programming Medium

Object-Oriented Programming Concepts

15 programming trivia questions and answers online spanning object-oriented programming concepts.

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 an 'object' in OOP?

  • A. An instance of a class ✓
  • B. A type of function
  • C. A loop
  • D. A data type

💡 An object is a specific instance created from a class, with its own data and behavior.

2. What is a 'static method' in OOP?

  • A. A method that belongs to the class rather than any instance ✓
  • B. A method that changes frequently
  • C. A method that cannot be called
  • D. A type of loop

💡 A static method belongs to the class itself rather than any particular instance of the class.

3. What is a 'class' in OOP?

  • A. A blueprint for creating objects ✓
  • B. An instance of an object
  • C. A type of loop
  • D. A variable

💡 A class serves as a blueprint that defines the properties and methods for creating objects.

4. What is 'method overloading'?

  • A. Defining multiple methods with the same name but different parameters ✓
  • B. Calling a method multiple times
  • C. Deleting a method
  • D. Combining two classes

💡 Method overloading allows multiple methods with the same name but different parameter lists to coexist.

5. What is 'inheritance' in OOP?

  • A. A mechanism where a new class derives properties and behavior from an existing class ✓
  • B. A way to delete a class
  • C. A type of loop
  • D. A data structure

💡 Inheritance allows a new class to derive properties and behaviors from an existing parent class.

6. What is 'abstraction' in OOP?

  • A. Hiding complex implementation details and showing only the necessary features ✓
  • B. Combining multiple classes
  • C. A type of loop
  • D. A sorting algorithm

💡 Abstraction hides complex implementation details, exposing only the necessary functionality to the user.

7. What is 'encapsulation' in object-oriented programming?

  • A. Bundling data and methods that operate on that data within a single unit ✓
  • B. Creating multiple classes
  • C. Writing loops
  • D. Compiling code

💡 Encapsulation bundles an object's data and the methods that operate on it into a single unit, or class.

8. What does 'this' or 'self' typically refer to in OOP languages?

  • A. The current instance of the object ✓
  • B. The parent class
  • C. A global variable
  • D. A static method

💡 'this' or 'self' refers to the current instance of the object within a class method.

9. What does 'method overriding' mean?

  • A. A subclass provides a specific implementation of a method already defined in its parent class ✓
  • B. Deleting a method
  • C. Creating a new class
  • D. Combining two methods

💡 Method overriding allows a subclass to provide its own specific implementation of a method inherited from its parent class.

10. What is a 'constructor' in OOP?

  • A. A special method used to initialize a new object ✓
  • B. A method that deletes an object
  • C. A type of loop
  • D. A variable

💡 A constructor is a special method automatically called when a new object is created, used to initialize it.

11. What is 'composition' in OOP?

  • A. Building complex objects by combining simpler objects ✓
  • B. Writing comments
  • C. Creating loops
  • D. Compiling code

💡 Composition builds complex objects by combining simpler, independent objects as components.

12. What does 'private' access modifier typically restrict?

  • A. Access to a class member from outside the class ✓
  • B. Access to all classes
  • C. Nothing
  • D. Only public access

💡 The 'private' access modifier restricts access to a class member so it can only be used within that class.

13. What is the difference between an abstract class and an interface?

  • A. An abstract class can have implemented methods, while an interface traditionally cannot ✓
  • B. They are identical
  • C. An interface can have implemented methods but an abstract class cannot
  • D. There is no difference

💡 Traditionally, abstract classes can contain both implemented and unimplemented methods, while interfaces only declare method signatures.

14. What is an 'interface' in OOP?

  • A. A contract that defines methods a class must implement, without providing implementation ✓
  • B. A type of loop
  • C. A variable
  • D. A sorting algorithm

💡 An interface defines a contract of methods that implementing classes must provide, without specifying how.

15. What is 'polymorphism' in OOP?

  • A. The ability of different classes to be treated as instances of the same class through a common interface ✓
  • B. A way to encrypt data
  • C. A type of loop
  • D. A sorting method

💡 Polymorphism allows objects of different classes to be treated through a shared interface, taking different forms.

More Programming Quizzes

View all Programming quizzes →