Question 4 Flashcards

1
Q

What is the probable content of this exam question?

A

(1) Can you navigate a path on a class diagram? (2) Can you give a loop invariant?

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

Look at Figure 1 of question 4 in the specimen exam paper. Is it possible to identify which prescriptions were issued by a doctor? Explain your answer in plain English.

A

Yes, it is possible. For a given doctor it is possible to find the set of all patients of that doctor following the association between Doctor and Patient; and for a givent patient, it is possible to find the set of all prescriptions for that patient following the association between Patient and Prescription.

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

Look at Figure 1 of question 4 in the specimen exam paper. Is it possible to identify which prescriptions were issued by a doctor? Explain your answer in Object Constrain Language (OCL)

A

context Doctor:

– The set of Prescriptions given by a Doctor of that Clinic.

self.patient.prescription.

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

Look at Figure 1 of question 4 in the specimen exam paper. For the association loop, find an invariant thhat should apply to the model. Write the invariant, in the context of the class Clinic, using an unambiguous description in English.

A

The set of all Patient instances linked to all Doctor instances of the Clinic is the same as the set of Patient instances linked to the Clinic.

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

Look at Figure 1 of question 4 in the specimen exam paper. For the association loop, find an invariant thhat should apply to the model. Write the invariant, in the context of the class Clinic, using Object Constraint Language (OCL).

A

context Clinic inv:

self.doctor.patient = self.patient

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