nus-cs2103-AY2324S2 / forum

16 stars 0 forks source link

[Practice Exam Question] Doubts about the class diagram on sub-activities #915

Open damithc opened 7 months ago

damithc commented 7 months ago

[SPOILER ALERT] This post reveals the answer to one of the practice exam questions. If you haven't done the practice exam yet, you might want to stop reading at this poing.

Given below are some questions received from another student. Posting here for discussion:

image

  1. Why the answer is (e)? My original answer was (b) as there is no mention of the sub-activities...
  2. Regarding this question about activity keeping track of sub-activities, I don't get why there is a composition relation...
  3. I believe that deletion of the main activity keeping track of the sub-activity does not mean that the sub-activity would get deleted?
  4. What do arrows mean in composition ? I notice that some composition have arrows while some don't, is there any difference?
itstrueitstrueitsrealitsreal commented 6 months ago

Is the answer E because the association between Activity and itself is shown twice, once as an attribute of activity and another time using the arrow?

baskargopinath commented 6 months ago

@itstrueitstrueitsrealitsreal i agree with u but why is C correct if parts is not mentioned anywhere

baskargopinath commented 6 months ago
  1. Why the answer is (e)? My original answer was (b) as there is no mention of the sub-activities...

Isn't sub-activities mentioned in the heading

tankh99 commented 6 months ago

Is the reason why E is correct because the sub-activity relationship is being expressed as a line and an attribute at the same time? Or is it because it is showing the sub-activity attribute with an invalid name?

tankh99 commented 6 months ago

@damithc bump

damithc commented 6 months ago

Is the answer E because the association between Activity and itself is shown twice, once as an attribute of activity and another time using the arrow?

This is the correct reason.

  • Regarding this question about activity keeping track of sub-activities, I don't get why there is a composition relation...
  • I believe that deletion of the main activity keeping track of the sub-activity does not mean that the sub-activity would get deleted?

Delete cascading is an effect of composition, not the cause. More info here

image

Also relevant, Q3 of week 9 briefing: image

4. What do arrows mean in composition ? I notice that some composition have arrows while some don't, is there any difference?

Arrow indicates navigability. It's independent of composition.