Question
What type of relationship is represented by Aggregation
in Object-Oriented Programming?Solution
Aggregation is a "has-a" relationship where one object is composed of other objects, but the lifecycle of the contained objects is independent of the containing object . For example, a Teacher class might be associated with a School class, but even if the School object is destroyed, the Teacher object can continue to exist. Aggregation emphasizes shared ownership and loosely coupled associations, making it useful for scenarios requiring flexibility in object dependencies. Why Other Options Are Incorrect :
- "Is-a" relationship : This refers to Inheritance , where a subclass derives from a parent class.
- "Has-a" relationship with exclusive ownership : This describes Composition , where the contained objects' lifecycle is tied to the container.
- Parent-child relationship : This typically relates to Inheritance or tree structures , not Aggregation.
- Object-to-object message communication : This aligns with Message Passing , which focuses on interaction between objects rather than relationships
- Best case complexity of insertion sort is: 
- Which of the following types of software testing ensures that previously working functionality is still operational after changes? 
- KMP pattern matching avoids: 
- Union-Find with path compression achieves nearly constant time because its complexity is: 
- Which of the following correctly describes the primary difference between Cross-Site Request Forgery (CSRF) and Cross-Site Scripting (XSS)? ...
- Which sorting algorithm is the most efficient for large datasets and uses a divide-and-conquer approach? 
- Tarjan’s algorithm is used to find: 
- Which of the following statements accurately describes the function of a Gantt Chart in project management? 
- Which of the following attacks can occur when a user is tricked into performing unintended actions on a trusted website without their knowledge? 
- What is the primary purpose of a B+ Tree in a database management system?