Object-Oriented Programming MCQs (Set-1)

What is an object in object oriented programming?

A A source file
B A loop condition
C Instance of a class
D A processor instruction

What does a class define?

A A running process
B A sorted array
C Object structure and behavior
D A database connection

What is encapsulation?

A Converting code to machine language
B Sorting objects by address
C Bundling state with operations
D Calling a function recursively

What is abstraction?

A Showing essentials, hiding details
B Copying every object field
C Making every method public
D Repeating a class definition

What does inheritance allow?

A An object changes its address
B A method runs in parallel
C A field becomes a constant
D A class derives from another

What is a base class?

A Class with no methods
B Object's runtime copy
C A private field
D Class inherited from

What is a derived class?

A A class with no fields
B Class inheriting another
C A compiled library
D A function parameter

What does a method represent?

A A memory address
B Operation associated with a class
C A stored database row
D A compiler setting

What is an instance field?

A Shared class behavior
B A loop variable only
C A global function
D Per object state

What is a class field commonly used for?

A Separate value per local variable
B Temporary method result
C State shared by class instances
D Object's private address

What does a constructor usually do?

A Destroy a derived class
B Initialize a new object
C Sort a method list
D Override every method

What is a default constructor?

A Constructor callable without arguments
B Constructor that deletes objects
C A method returning a class
D A constructor declared private always

What is a destructor used for?

A Create the first instance
B Overload an operator
C Declare an interface
D Release object resources

What does a private member mean?

A Accessible everywhere
B Restricted to class implementation
C Accessible only to subclasses
D Stored outside the object

What does a public member mean?

A Accessible only inside class
B Accessible through public interface
C Never callable by objects
D Shared across all programs

What does protected access commonly allow?

A Every program access
B No method access
C Only constructor access
D Class and derived class access

What is an object's state?

A Current field values
B Its class source file
C Its method names only
D The program's call stack

What is an object's behavior?

A Operations it can perform
B Its memory address only
C The order classes compile
D All global values

What does message passing mean in OOP?

A Classes compile without files
B Objects share all fields
C Objects request behavior from others
D Methods run only at startup

What does composition express?

A Strong whole part ownership
B A temporary method call
C A class name alias
D A sort order

What is an association between classes?

A A type conversion rule
B A class compiler warning
C A constructor argument list
D Relationship between their objects

What does an is a relationship usually suggest?

A Inheritance
B Composition
C Method overloading
D Data hiding only

What does a has a relationship often suggest?

A Method overriding
B Composition or aggregation
C Recursion
D Static dispatch

What is a class invariant?

A Method called once only
B Field without a type
C Condition that should remain true
D Object's memory size

Why use accessors and mutators carefully?

A Preserve class invariants
B Make every field global
C Remove all constructors
D Disable polymorphism