ADVANCED TOPICS IN COMPILER DESIGN
CODE GENERATION FOR OBJECT ORIENTED LANGUAGES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Aggregation
|
|
Composition
|
|
Encapsulation
|
|
Association
|
Detailed explanation-1: -Right option is (d) Association. To elaborate: It is a relationship where all objects have their own lifecycle and there is no owner. This occurs where many to many relationships are available, instead of one to one or one to many.
Detailed explanation-2: -Definition. Association refers to “has a” relationship between two classes which use each other. Aggregation refers to “has a"+ relationship between two classes where one contains the collection of other class objects. 2.
Detailed explanation-3: -We can break the life of an object into three phases: creation and initialization, use, and destruction. Object lifecycle routines allow the creation and destruction of object references; lifecycle methods associated with an object allow you to control what happens when an object is created or destroyed.
Detailed explanation-4: -The correct option is (b) Composition. Easiest explanation: Composition occurs when child object gets killed if parent object gets killed.