quiz image

UML Collections

LuxuryAbundance avatar
LuxuryAbundance
·
·
Download

Start Quiz

Study Flashcards

40 Questions

What is the strongest relationship between objects according to the provided content?

Composition

What is the relationship between a Tree and its Leaf?

Composition

What is the relationship between a Business and its Departments?

Composition

What is the term used to describe the 'has-a' relationship between objects?

Aggregation

What is the relationship between a Student and a Person?

Composition

What type of relationship is characterized by 'uses'?

Association

What is the term used to describe the number of objects in a relationship?

Cardinality

What type of relationship is characterized by 'consist of'?

Composition

What is the primary purpose of UML?

To model and visualize software systems

What is an example of a part-whole relationship in object-oriented programming?

A car has wheels

What is the main difference between aggregation and composition?

Composition is a stronger relationship than aggregation

What type of relationship is represented by the 'has-a' phrase?

Has-a

What is the term for a class that contains a collection of objects?

Collection class

What is an association in object-oriented programming?

A relationship between two classes

What is the term for a class that is contained by another class?

Inner class

What is the term for a whole that is composed of multiple parts?

Aggregate

What is the primary purpose of UML in software development?

To communicate aspects of the system through sketching

What type of relationship is represented by a 'uses' or 'references' relationship between classes?

Association

What is the main difference between aggregation and composition?

Composition is a stronger has-a relationship, while aggregation is a weaker has-a relationship

What is an example of a composition relationship?

A car has an engine

What type of relationship is represented by a 'has-a' relationship between classes?

Aggregation

What is the main characteristic of an association relationship?

One class uses or references the other class

What is an example of an aggregation relationship?

A duck has a pond

What is the main difference between an aggregation and a composition relationship?

Aggregation is a weaker has-a relationship, while composition is a stronger has-a relationship

What is the relationship between Circle and GeometricShape?

Circle is a subtype of GeometricShape

What type of relationship exists between Circle and its attributes?

Has-a Relationship

What is the relationship between Rectangle and Square?

Square is a subtype of Rectangle

What type of relationship exists between GeometricShape and its subclasses?

Inheritance

What is the relationship between Circle and its behaviors?

Has-a Relationship

What type of relationship exists between cuboid and Three Dim GeometricObject?

Inheritance

What is the relationship between GeometricShape and its attributes?

Has-a Relationship

What type of relationship exists between Rectangle and its dimensions?

Has-a Relationship

What does the solid diamond on one end of a line in a UML class diagram indicate?

Aggregation

What is the relationship between objects of two classes connected by a line with a solid diamond on one end?

Part-Whole Relationship

What is the association between two classes represented by a simple line in a UML class diagram?

Association

What does the cardinality 0..1 indicate in a UML class diagram?

Zero or one

What does the cardinality 1..* indicate in a UML class diagram?

One or more

In a UML class diagram, what is the difference between an aggregation and a composition?

Aggregation is weaker than composition

What is the difference between an association and a has-a relationship?

An association is a more general term than a has-a relationship

In a UML class diagram, what is the purpose of the access level modifiers?

To indicate the access level of class members

Study Notes

Relationships between Objects

  • Composition: A Vehicle has a Cabin and Trunk Space, which do not exist without the enclosing Vehicle.
  • A Business is composed of Departments, which do not exist without the Business.
  • A Student has a Person (with personal properties), which do not exist without the Person.

UML – Unified Modeling Language

  • A general-purpose developmental modeling language.
  • A standard way to visualize the design of a system.
  • Many types of languages exist.

Uses of UML

  • As a sketch: to communicate aspects of the system during brainstorming.
  • As a blueprint: a complete design to be implemented.
  • As a programming language: tools available to auto-generate the structure of the code from the UML.

UML Diagrams

  • Association: a general relationship between classes.
  • Aggregation: a special form of association where Class A has Class B as a property.
  • Composition: a restricted form of aggregation where the Part cannot exist without the Whole.

Association

  • Weakest relationship between classes.
  • Class A uses/references Class B.
  • Examples: Employee class & Scanner class, Owner class & Pet class.

Aggregation

  • A special form of association where Class A has Class B as a property.
  • Examples: A duck has-a pond, College has multiple students.

Composition

  • A restricted form of aggregation where the Part cannot exist without the Whole.
  • Examples: A Vehicle has-a Cabin and Trunk Space, A Business is composed of Departments.

UML Class Diagram

  • Top compartment: class name (centered and bold).
  • Middle compartment: State (attributes, properties, instance or class variables).
  • Bottom compartment: Behaviors (methods).
  • Access Level Modifiers: + (public), # (protected), ~ (package protected), - (private).

UML Relationships

  • Lines drawn between class boxes indicate relationships between objects of the classes.
  • Cardinality: numbers at either end of an association line represent how many of each are involved.

Inheritance

  • Circle and Rectangle are subclasses of Geometric Shape.
  • Circle and Rectangle are subtypes of supertype GeometricShape.
  • Circle inherits all attributes of Geometric Shape.

This quiz explores the concept of composition in object-oriented relationships, where objects are composed of other objects that do not exist independently. Examples include vehicles, businesses, and students.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser