Object-Oriented Programming MCQs (Set-3)

What is aggregation?

A Subclass method replacement
B Compile time method selection
C Weaker whole part relationship
D Object copying by value only

How does composition differ from aggregation?

A Part must be a superclass
B Composition prevents methods
C Part lifetime tied to whole
D Aggregation requires same class

What is dependency between classes?

A One class extends every type
B Two objects share an address
C One class uses another
D A field has no value

What is constructor chaining?

A A constructor recursively loops forever
B A destructor creates an object
C A method overrides a field
D One constructor invokes another

Why call a superclass constructor?

A Delete parent methods
B Make private fields public
C Avoid creating the subclass
D Initialize inherited state

What is object identity?

A Same object identity
B Whether two values are equal
C The object's class name
D The order it was constructed

What is value equality?

A Whether references share an address
B Whether objects represent equivalent data
C Whether classes share a base
D Whether objects have same methods

What is shallow copying?

A Copies entire object graph
B Moves the object to disk
C Copies top level fields
D Duplicates class definitions

What is deep copying?

A Copies only the outer reference
B Copies nested reachable objects
C Shares every nested object
D Converts object to an interface

What can a mutable object change?

A Its class name always
B Its state after creation
C Its method signature
D Its type hierarchy

What does immutability mean?

A State cannot change after creation
B Object has no fields
C Object cannot be referenced
D Methods cannot return values

What is object aliasing?

A Multiple references to same object
B Two classes with same name
C Two fields with equal values
D One object without a class

Why can aliasing cause bugs?

A Objects stop being mutable
B Methods cannot be called
C Classes become abstract
D Changes visible through other references

What does garbage collection reclaim?

A All objects only at exit
B All class definitions
C Objects still in use
D Unreachable managed objects

What is deterministic resource cleanup?

A Automatic random memory freeing
B Explicit release at known point
C A class without a destructor
D A field initialized twice

What is RAII in C++?

A Resource follows object lifetime
B A runtime interface for arrays
C Random access inheritance scheme
D A method dispatch algorithm

What is a factory method used for?

A Sort objects by class
B Compare object identity
C Release memory manually
D Encapsulate object creation choice

What is a singleton pattern intended to ensure?

A One method per class
B Every object is immutable
C One shared instance
D No object can be created

What does the observer pattern define?

A One to many notification
B Whole part ownership
C Subclass constructor chaining
D An object sorting order

What does the strategy pattern encapsulate?

A A single global object
B A class hierarchy diagram
C Object memory allocation
D Interchangeable algorithms

What does the decorator pattern add?

A A new inheritance root
B A global variable
C Behavior around an object
D A sorted object collection

What does dependency injection provide?

A Dependencies from outside
B Fields directly from subclasses
C Runtime method names only
D Methods without parameters

What does coupling measure?

A Methods per class only
B Dependency between components
C Object size in bytes
D Number of tests run

What does cohesion measure?

A Relatedness of class responsibilities
B Inheritance depth only
C Number of constructor arguments
D Class memory address

What does the open closed principle suggest?

A Open every field to public
B Extend without modifying
C Close all classes to inheritance
D Change every client