4. Quiz Questions

Questions 1-3 are based on the following OO class model:

4.1. Question 1: Adding references

The following addMember methods are supposed to be part of the JS class that implements the Committee class from the above class model. Which of the following methods is correct? Select one:

  1. O

    class Committee {
      ...
      addMember( m) {
        this._members[m.memberNo] = m;
        m.committes[this._name] = this;
      }
      ...
    }
  2. O

    class Committee {
      ...
      addMember( m) {
        this._members[m.name] = m;
        m.committes[this._name] = this;
      }
      ...
    }
  3. O

    class Committee {
      ...
      addMember( m) {
        this._members[m.memberNo] = m;
        m.committes[this._name] = m.chairedCommittee;
      }
      ...
    }

4.2. Question 2: Maintaining a pair of mutually inverse reference properties

Maintaining the derived set of inverse references that form the collection value of the derived inverse reference property ClubMember::committees requires that ... (select one or more):

  1. ☐ Whenever a ClubMember object reference m is added to the collection value c.members of a Committee object c (with the help of the addMember method), also the inverse object reference c has to be added to m.committees.

  2. ☐ Whenever a ClubMember object reference m is removed from the collection value c.members of a Committee object c (with the help of the removeMember method), also the inverse object reference c has to be removed from m.committees.

  3. ☐ Whenever a Committee object c (with multiple ClubMember object references c.members) is destroyed, all ClubMember objects m where the collection value m.committees contains m have to be destroyed as well, or, alternatively, c has to be removed from the collection values m.committees for all ClubMember objects m.

  4. ☐ Whenever a new Committee object c is created with a set of ClubMember object references members as the value to be assigned to c.members, c has to be added to m.committees for all ClubMember objects m from members.

4.3. Question 3: Making a JS class model

Which is the correct JS class model for the ClubMember class derived from the above model? Select one:

  1. O

  2. O

  3. O