Quiz 4 Flashcards
In a class diagram, what does a binary association represent?
- A relationship between two classes
- A relationship between three classes
- A relationship within a single class
- None of the above
A relationship between two classes
In terms of navigability, which symbol represents that Class A knows about Class B, but not vice versa?
- A simple line
- An arrow pointing from Class A to Class B
- An arrow pointing from Class B to Class A
- A dotted line
An arrow pointing from Class A to Class B
Consider the following scenario: “A university has multiple departments, and each department offers multiple courses. If the university ceases to exist, the departments and their courses would also cease to exist.” Which relationship best represents the relationship between the university and departments?
- Association
- Generalization
- Aggregation
- Composition
Composition
Consider the following scenario: “A library contains many books, but a book can exist outside of a library.” Which relationship best represents the relationship between the library and books?’
- Association
- Generalization
- Aggregation
- Composition
Aggregation
Consider a complex software system with multiple interacting components, each having distinct attributes and operations. When modelling such a system using a class diagram, what strategy should be employed to ensure clarity and maintainability of the diagram?
- Include all components, attributes, and operations in a single comprehensive diagram.
- Break down the system into smaller, manageable modules and create separate class diagrams for each, highlighting key interactions.
- Focus only on the primary components and relationships, omitting less critical attributes and operations.
- Create a hierarchical class diagram, placing the most crucial components at the top and less essential ones at the bottom.
Break down the system into smaller, manageable modules and create separate class diagrams for each, highlighting key interactions.
Which of the following is a difference between shared aggregation and composition in a class diagram?
- Shared aggregation represents a “whole-part” relationship, while composition does not.
- Composition represents a “whole-part” relationship, while shared aggregation does not.
- In shared aggregation, the part can exist independently of the whole, but in composition, it cannot.
- In composition, the part can exist independently of the whole, but in shared aggregation, it cannot.
In shared aggregation, the part can exist independently of the whole, but in composition, it cannot.
Which of the following multiplicities indicates that an instance of Class A can be associated with exactly one instance of Class B? (Select all the correct options)
- 0..1
- 1..1
- 0..*
- 1..*
- 1
1..1
1
+——————-+
+——————-+
| name |
| phone_number |
| email_address |
+——————-+
|—————————–|
| (inherits) |
| |
+——————-+ +——————-+
| Student | | Professor |
+——————-+ +——————-+
| student_number | | salary |
| average_grades | +——————-+
+——————-+
(Person has a relationship with Address)
+——————-+
| Address |
+——————-+
| street |
| city |
| state |
| postal_code |
| country |
+——————-+
| validate() |
| output_as_label() |
+——————-+
(Person lives at Address with a relationship of 0..1 to 1)
onsider the above diagram. Which relationships are incorrectly represented? (Select all that apply)
- Person to Professor
- Person to Student
- Person to address
- None of the above
Person |
Person to Professor
Person to Student
Company Employee
| |
| |
| |
| |
| |
(company 1 binary association 0..* dep)
Department (employee 1 shared aggregation 1* dep)
Referring to the above diagram, which of the following statements is true?
- An employee can be a manager of multiple employees.
- A department can exist without a company.
- A company can have multiple departments but an employee can belong to only one department.
- An employee can belong to multiple departments.
A company can have multiple departments but an employee can belong to only one department.
+—————-+ +—————-+
| Doctor | — | Patient | (d->p aggregation)
+—————-+ +—————-+
| 1
|
|
v (aggregation)
+—————-+ +—————-+
| Ward |<—->| (assigned) |
+—————-+ +—————-+
^ 0..* ^ 0..* (aggregation)
| |
| 1 | 1..*
| |
+—————-+ +—————-+
| Hospital | | Nurse |
+—————-+ +—————-+
(hospital -> ward inhertiance)
In this hospital: Each ward is a part of the hospital, and without the hospital, a ward cannot exist. Patients are admitted to specific wards, and a ward can have multiple patients at any given time. Doctors are assigned to specific wards, and a doctor can be responsible for patients in multiple wards.Nurses are also assigned to specific wards, and a nurse can attend to multiple wards simultaneously. If a ward is closed or removed, which of the following statements are true? (Choose all that apply)
- Only the patients in that ward will be affected.
- The doctors and nurses assigned to that ward will no longer have an association with it.
- The hospital will cease to exist.
- The doctors will be reassigned, but the nurses will not.
Only the patients in that ward will be affected.
The doctors and nurses assigned to that ward will no longer have an association with it.
In a banking system, a customer can have multiple accounts, but if a customer is deleted, all associated accounts should also be deleted. Similarly, an account can have multiple transactions, but if an account is closed, all its transactions should also be removed. Which pairs of classes in the system most likely use composition as a relationship? (Select all that apply)
- Customer and Bank
- Account and Transaction
- Customer and Account
- Transaction and Bank
Account and Transaction
Customer and Account
In a transportation system, a vehicle can be a car, a bus, or a bike. All vehicles have common attributes like speed and capacity, but each type of vehicle has specific attributes. Which relationship best describes the connection between ‘Vehicle’ and its specific types?
- Aggregation
- Composition
- Association
- Generalization
Generalization
True/False In a class diagram, a composition relationship implies that the lifetime of the part class is dependent on the lifetime of the whole class.
- True
- False
True
True/False In a class diagram, an aggregation relationship implies a stronger relationship compared to composition, meaning the part class cannot exist independently of the whole class.
- True
- False
False
True/False In a class diagram, navigability determines the direction in which a relationship can be traversed or queried. It does not imply any form of ownership or containment.
- True
- False
True
True/False Multiplicity in a class diagram can only have values of 0, 1, or many (*).
- True
- False
False
In a library system, a book can be borrowed by multiple members over time, but at any given time, it can be borrowed by only one member. A member can borrow multiple books. What kind of multiplicity exists between the ‘Book’ and ‘Member’ classes?
- 0..*
- 1..1
- 0..1
- 1..*
0..1