Question
In OOP, what term best describes the relationship where
one object is a part of another but cannot exist independently?Solution
Composition is a "has-a" relationship where one object contains another, and the contained object cannot exist independently of the parent. 1. Dependency: For instance, an engine is part of a car and cannot function independently outside of it. 2. Tight Coupling: The lifecycle of the child object depends entirely on the parent object. If the parent is destroyed, the child is destroyed too. 3. Reusability: Composition fosters code reuse by enabling modular design without strict inheritance hierarchies. Option A exemplifies composition through its strong containment relationship, central to creating complex, interdependent systems. Why Other Options Are Incorrect: • B) Aggregation: Denotes a weaker "has-a" relationship, where components can exist independently. • C) Inheritance: Refers to property sharing, not containment. • D) Polymorphism: Focuses on method behavior variability. • E) Association: A general relationship without specific containment rules.
It will cruise in the atmosphere like an aircraft and it has capable of travelling up to  1,000 km.
The company has decided to expand (1)/ its operations onto new markets, (2)/ which will allow them to increase (3)/ their profits in the upcoming quarte...
This question consists of a sentence that is divided into four parts numbered (1) to (4). Only one part of the sentence is not acceptable in standard w...
As parts of the efforts of the congress to evolve a consensus to its allies over a presidential candidate, senior party leader and Defence Minister call...
Identify the segment in the sentence, which contains the grammatical error.
Each student will have to carry his own lunch on the picnic.
I feel the protective (A) / instinct of a son want to (B) / prevent his mother from hurting. (C) / No error (D)
Read the given sentence to find out whether there are any grammatical/ contextual errors in them. The errors, if any, will be in two of the parts of th...
We should focus on only one thing in the time.
We have sufficient/ food and clothing/ about the flood victims/ in Kerala.
In the following questions, a sentence is divided into four parts among which three parts may or may not contain errors. It is then followed by four alt...