Quiz 4 Flashcards

1
Q

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

A relationship between two classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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
A

An arrow pointing from Class A to Class B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A

Composition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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
A

Aggregation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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.
A

Break down the system into smaller, manageable modules and create separate class diagrams for each, highlighting key interactions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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.
A

In shared aggregation, the part can exist independently of the whole, but in composition, it cannot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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
A

1..1

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

+——————-+
+——————-+
| 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 |

A

Person to Professor

Person to Student

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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

A company can have multiple departments but an employee can belong to only one department.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

+—————-+ +—————-+
| 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.
A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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
A

Account and Transaction

Customer and Account

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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

A

Generalization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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
A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

True/False Multiplicity in a class diagram can only have values of 0, 1, or many (*).

  • True
  • False
17
Q

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..*