Association, Aggregation & Composition in Programming Technique II
10 Questions
2 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the main difference between association and aggregation?

  • Association indicates one-to-one relationships, while aggregation indicates one-to-many relationships.
  • The existence of objects in association is independent, while in aggregation it is not. (correct)
  • Association is a one way relationship, while aggregation is a two-way relationship.
  • Aggregation models a 'has a' relationship, whereas association models an 'is a' relationship.
  • In the context of relationships between classes through their objects, what is a common feature of association and aggregation?

  • Both can have one to many, many to one, or many to many relationships. (correct)
  • Both can only have one-to-one relationships.
  • Both can only have two-way relationships.
  • Both are implemented by objects containing pointers to other objects.
  • Which statement best describes an aggregation relationship?

  • The existence of objects in aggregation is independent of each other.
  • Aggregation models an 'is a' relationship between classes.
  • Aggregation implies that the enclosed class has a relationship with the enclosing class. (correct)
  • Aggregation indicates a one-to-one relationship between classes.
  • How does an aggregation relationship differ from an association relationship?

    <p>Aggregation indicates a 'has a' relationship, while association indicates an 'is a' relationship.</p> Signup and view all the answers

    What type of relationship does association indicate between classes through their objects?

    <p>Is a relationship</p> Signup and view all the answers

    In the context of aggregations, what happens if a student withdraws from a course?

    <p>The pointer between the student and the course is broken, but the course still exists for other students.</p> Signup and view all the answers

    What is the purpose of using pointers in aggregation?

    <p>To represent a relationship between objects without destroying the related object.</p> Signup and view all the answers

    What distinguishes compositions from aggregations?

    <p>Compositions have a stronger ownership relationship and the part objects depend on the whole objects.</p> Signup and view all the answers

    What does it mean when it is said that 'the whole object is responsible for creation and destruction of its part(s)' in compositions?

    <p>The whole object has complete control over the creation and destruction of its part objects.</p> Signup and view all the answers

    Why is it important to use aggregations or compositions instead of directly creating new objects in certain scenarios?

    <p>To model whole/part relationships and control the existence of related objects.</p> Signup and view all the answers

    More Like This

    Association Football
    9 questions
    Association Knowledge Quiz
    6 questions

    Association Knowledge Quiz

    QuietPrairieDog8970 avatar
    QuietPrairieDog8970
    Association and Causality Quiz
    5 questions
    Use Quizgecko on...
    Browser
    Browser