Object-Oriented Programming Concepts Flashcards
7 cards from real AMCAT practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Object-Oriented Programming Concepts flashcards as text
Which OOP principle bundles data and methods that operate on that data within a single unit, restricting direct access from outside?
Answer: Encapsulation
Encapsulation wraps data (attributes) and behavior (methods) together in a class and controls access through access modifiers like private, protected, and public.
When a child class acquires the properties and behaviors of a parent class, this OOP concept is called:
Answer: Inheritance
Inheritance allows a derived (child) class to reuse the fields and methods of a base (parent) class, promoting code reuse.
Which of the following best describes polymorphism in OOP?
Answer: The same interface can be used for different underlying data types
Polymorphism means 'many forms' — the same method name or interface can behave differently depending on the object it operates on.
What is an abstract class in object-oriented programming?
Answer: A class that cannot be instantiated and may contain abstract methods
An abstract class serves as a blueprint for other classes; it cannot be instantiated on its own and may define abstract methods that subclasses must implement.
Which of the following correctly distinguishes a class from an object?
Answer: A class is a blueprint; an object is an instance of that class
A class defines the structure and behavior (blueprint), while an object is a concrete instance created from that class at runtime.
Method overloading allows a class to define multiple methods with the same name but different:
Answer: Parameter lists (number or type of parameters)
Method overloading (compile-time polymorphism) requires methods to differ in their parameter list — either in the number, type, or order of parameters.
In OOP, an interface is best described as:
Answer: A contract specifying method signatures that implementing classes must define
An interface defines a contract — it declares method signatures (and sometimes constants) without providing implementation, and any class that implements it must provide the bodies.