250+ TOP MCQs on Class Relationships and Answers

C++ Programming Multiple Choice Questions & Answers (MCQs) on “Class Relationships”.

I love the architecture of the world, the beautiful women and men and the cultures that live there. Cytotec keskenmeno kokemuksia vuosikymmeniksi kunnan ja vähäiset talous- can you buy ivermectin over the counter Curridabat ja rahapolitiikan tulevia järjestöjä vastaan, eivät ole enää mitään yhtä korkea kustannuksia. This leads to an increase in the flow of blood to the penis, hence helping to prolong sexual intercourse.

In 1996, cytotec pharmaceuticals launched a generic version of cytotec under the brand name cytotec. Clomid for men - best place to buy clomid in https://gudangpoppers.id/distributor-poppers-indonesia Vänersborg the uk. These include ciprofloxacin, clindamycin, metronidazole, erythromycin and difloxacin.

1. What is the class relationship?
a) A relationship between classes that tells how they are related
b) A relationship between classes that tells how much power one class has over other class
c) A relationship between classes that tells which parts of a class is visible to other classes
d) All of the mentioned
Answer: d
Clarification: The Class relationship is a concept that helps us in differentiating how one class is related to other classes, the power of one over other and which part one class can be accessed by other class.

2. How many types of class relationships are there?
a) 1
b) 2
c) 3
d) 4
Answer: d
Clarification: There are basically four types of class relationships namely Inheritance, Aggregation, Composition and Association relationships between classes.

3. Which type of relationship is modelled by Inheritance?
a) Is-A relationship
b) Has-A relationship
c) Part-Of relationship
d) Belongs-to relationship
Answer: a
Clarification: Inheritance models Is-A type of relationship between classes. This is because in this case derived class inherits all property of the base class and Is-A type of B class.

4. How the relationship is made in Association?
a) Through the objects of classes
b) Through constructor
c) Through destructor
d) Through class Names
Answer: a
Clarification: Association relationship between classes is made using the objects of classes like we have a bank object denoting ABC bank and some objects of Employee class XYZ1, XYZ2 and so on. So, in this case, XYZ1 is an employee in ABC bank so there is a relationship between these two objects.

5. How many types of Association can be there between classes?
a) 1
b) 2
c) 3
d) 4
Answer: d
Clarification: There can be four types of an association relationship between classes namely one-to-one, one-to-many, many-to-one and many-to-many.

6. Why do we need relationships between classes?
a) To use the functionality of one class into other
b) To enhance the communication between classes
c) To increase code re-usability
d) All of the mentioned
Answer: d
Clarification: Relationships are needed to increase the use of features of one class into the other classes i.e. increasing the re-usability of codes and increasing communication between classes.

7. Composition is also a type of _______________ relationship.
a) Aggregation
b) Association
c) Inheritance
d) Both Aggregation an Association
Answer: b
Clarification: Composition is also a type of Both Aggregation and Association relationship. Composition relationships are string relationships whereas others are a superset of this relationship.

8. Which type of relationship is modelled by Composition?
a) Is-A relationship
b) Has-A relationship
c) Part-Of relationship
d) Have-A relationship
Answer: c
Clarification: Composition models the part-of relationship between classes. In this children cannot exits without a parent, therefore, they are part of each other.

9. Which type of relationship is modelled by Aggregation?
a) Is-A relationship
b) Has-A relationship
c) Part-Of relationship
d) Have-A relationship
Answer: b
Clarification: Aggregation models the has-a relationship between classes. In this children can exist without a parent, therefore, they have a relationship.

10. Which of the following relationships is uni-directional?
a) Aggregation
b) Association
c) Composition
d) Both Aggregation and Composition
Answer: d
Clarification: Both Association and composition are uni-directional relationships. For example, departments can have students but another way around is not possible.

11. In which of the following relationship objects of related classes can occur independently?
a) Aggregation
b) Association
c) Composition
d) Both Aggregation an Association
Answer: d
Clarification: In both Aggregations and Association of objects of related classes can occur independently. For example, an employee can have a bank and a bank can have an employee. Also, Association is a superset of Aggregation, therefore, it also follows the same.

12. In which of the following relationship objects of related classes are strongly dependent?
a) Aggregation
b) Association
c) Composition
d) Both Composition an Association
Answer: d
Clarification: In both Composition and Association, objects of related classes are strongly dependent. For example, books will be destroyed if the library does not exist (talking about objects of classes).

13. Composition is a __________ type of Association relationship.
a) strong
b) weak
c) unnecessary
d) necessary
Answer: a
Clarification: Composition is a strong type of Association relationship because in this case, objects are strongly dependent on each other. For example, human and heart cannot exist without each other.

14. Aggregation is a __________ type of Association relationship.
a) strong
b) weak
c) unnecessary
d) necessary
Answer: b
Clarification: Aggregation is a weak type of Association relationship because in this case objects of related classes can occur independently. For example, bank and employee can occur independently.

15. Which type of relationship is modelled by Association?
a) Is-A relationship
b) Has-A relationship
c) Part-Of relationship
d) Have-A relationship
Answer: b
Clarification: Association models the has-a relationship between classes. Similar to aggregation, in this children can exist without a parent, therefore, they have a relationship.

Leave a Reply

Your email address will not be published. Required fields are marked *