FliQi Education App Download
प्रश्न-बैंक · Programmer Java

OOPs Concepts - Relationships in java — प्रश्न और उत्तर

Programmer Java · 58 जाँचे हुए (verified) प्रश्न

  • 58 जाँचे हुए प्रश्न
  • हिंदी + English

पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।

भाषा
प्रश्न 1उत्तर + हल
"use-a" संबंध का उपयोग करने का निम्नलिखित में से कौन-सा लाभ है?
Which of the following is an advantage of using a "use-a" relationship?
  1. Aइससे क्लासों के बीच मज़बूत जुड़ाव (tight coupling) बनता है।It leads to tight coupling between classes.
  2. Bइससे कोड की पुनः उपयोगिता (code reusability) बढ़ती है।It enhances code reusability.
  3. Cइससे कोडबेस का लचीलापन (flexibility) घटता है।It reduces the flexibility of the codebase.
  4. Dइससे क्लासों का डिज़ाइन जटिल हो जाता है।It complicates the design of the classes.

सही उत्तर / Answer: (B)

हल / Solution
"use-a" संबंध में एक क्लास वही logic दोबारा लिखने के बजाय दूसरी क्लास की बनी-बनाई methods कॉल करती है। एक ही सहायक क्लास, जैसे Calculator या Logger, कई क्लासों के काम आ जाती है। इससे कोड की पुनः उपयोगिता (code reusability) बढ़ती है। यह जुड़ाव ढीला (loose coupling) होता है। मज़बूत जुड़ाव (tight coupling), कम लचीलापन (flexibility) और जटिल डिज़ाइन तो नुक़सान हैं, लाभ नहीं। इसलिए विकल्प 2 सही है।
In a "use-a" relationship a class calls the ready-made methods of another class instead of writing that logic again. The same helper class, such as a Calculator or Logger, can then serve many classes, so code reusability increases. The link is loose, so it does not create tight coupling. Tight coupling, lower flexibility and a more complex design are disadvantages, not advantages. So option 2 is correct.
प्रश्न 2उत्तर + हल
"use-a" संबंध में मुख्य ध्यान किस बात पर होता है?
In a "use-a" relationship, what is the primary focus?
  1. Aक्लासों के बीच डेटा साझा करना।Sharing data between classes.
  2. Bक्लासों के अंदर व्यवहार (behavior) को एनकैप्सुलेट (encapsulate) करना।Encapsulating behavior within classes.
  3. Cदूसरी क्लास द्वारा दी गई कार्यक्षमता (functionality) का पुनः उपयोग (reuse) करना।Reusing functionality provided by another class.
  4. Dक्लासों के बीच पदानुक्रम (hierarchy) वाले संबंध बनाना।Establishing hierarchical relationships between classes.

सही उत्तर / Answer: (C)

हल / Solution
"use-a" संबंध का मुख्य उद्देश्य दूसरी क्लास में पहले से बनी कार्यक्षमता (functionality) का पुनः उपयोग (reuse) करना है। एक क्लास वही logic दोबारा लिखने के बजाय दूसरी क्लास की methods कॉल कर लेती है। जैसे log लिखने के लिए Logger क्लास का उपयोग करना। डेटा साझा करना इसका लक्ष्य नहीं है। व्यवहार को छिपाना एनकैप्सुलेशन (Encapsulation) का अलग सिद्धांत है। पदानुक्रम (hierarchy) बनाना इनहेरिटेंस (Inheritance) का काम है। इसलिए विकल्प 3 सही है।
The main purpose of a "use-a" relationship is to reuse functionality that another class already provides. Instead of writing the same logic again, a class simply calls the other class's methods, such as using a Logger to write logs. Sharing data is not its goal. Encapsulating behavior is a separate OOP principle. Building class hierarchies is the job of inheritance, the "is-a" relationship. So option 3 is correct.
प्रश्न 3उत्तर + हल
Java में "use-a" संबंध आमतौर पर कैसे लागू (implement) किया जाता है?
In Java, how is a "use-a" relationship typically implemented?
  1. Aइनहेरिटेंस (inheritance) के द्वारा।Through inheritance.
  2. Bकम्पोज़िशन (composition) के द्वारा।Through composition.
  3. Cएग्रीगेशन (aggregation) के द्वारा।Through aggregation.
  4. Dमेथड इनवोकेशन (method invocation) के द्वारा।Through method invocation.

सही उत्तर / Answer: (D)

हल / Solution
"use-a" संबंध आमतौर पर मेथड इनवोकेशन (method invocation) से बनता है। एक क्लास दूसरी क्लास का ऑब्जेक्ट method के parameter में लेती है या method के अंदर बनाती है। फिर केवल उस काम के लिए उसकी methods कॉल करती है। जैसे Driver.drive(Car c) के अंदर c.start() कॉल होना। इनहेरिटेंस (Inheritance) "is-a" संबंध देता है। कम्पोज़िशन (Composition) और एग्रीगेशन (Aggregation) "has-a" संबंध देते हैं। इसलिए विकल्प 4 सही है।
A "use-a" relationship is usually built through method invocation. One class receives an object of another class as a method parameter, or creates it locally, and calls its methods only for that task. For example, Driver.drive(Car c) calls c.start(). Inheritance gives an "is-a" relationship. Composition and aggregation give "has-a" relationships, where the other object is kept as a field. So option 4 is correct.
प्रश्न 4उत्तर + हल
"use-a" संबंध में एक क्लास द्वारा दूसरी क्लास का "उपयोग" करने का क्या अर्थ है?
In a "use-a" relationship, what does it mean for one class to use another class?
  1. Aइसका अर्थ है कि एक क्लास दूसरी क्लास की subclass है।It means one class is a subclass of another class.
  2. Bइसका अर्थ है कि एक क्लास दूसरी क्लास के ऑब्जेक्टों से मिलकर बनी है।It means one class is composed of objects of another class.
  3. Cइसका अर्थ है कि एक क्लास में ऐसी methods हैं जो दूसरी क्लास की methods को कॉल (invoke) करती हैं।It means one class contains methods that invoke methods of another class.
  4. Dइसका अर्थ है कि एक क्लास दूसरी क्लास के साथ instance variables साझा करती है।It means one class shares instance variables with another class.

सही उत्तर / Answer: (C)

हल / Solution
जब एक क्लास दूसरी क्लास का "उपयोग" करती है, तो उसकी अपनी methods दूसरी क्लास की methods कॉल करके काम करवाती हैं। जैसे Printer क्लास की कोई method, Formatter ऑब्जेक्ट की format() method कॉल कर सकती है। subclass होना इनहेरिटेंस (Inheritance) यानी "is-a" संबंध है। दूसरी क्लास के ऑब्जेक्टों से बना होना कम्पोज़िशन (Composition) यानी "has-a" संबंध है। "use-a" में instance variables साझा नहीं होते। इसलिए विकल्प 3 सही है।
When one class "uses" another, its own methods call the methods of the other class to get some work done. For example, a Printer class method may call a Formatter object's format() method. Being a subclass is inheritance, an "is-a" relationship. Being made up of objects of another class is composition, a "has-a" relationship. Classes do not share instance variables in a "use-a" relationship. So option 3 is correct.
प्रश्न 5उत्तर + हल
निम्नलिखित में से कौन-सा Java में "use-a" संबंध का उदाहरण है?
Which of the following is an example of a "use-a" relationship in Java?
  1. Aडेटाबेस कनेक्शन को दर्शाने वाली क्लास, जो JDBC का उपयोग करती है।A class representing a database connection using JDBC.
  2. Bविश्वविद्यालय को दर्शाने वाली क्लास, जिसमें छात्रों की सूची है।A class representing a university with a list of students.
  3. Cकार को दर्शाने वाली क्लास, जिसमें इंजन ऑब्जेक्ट है।A class representing a car with an engine object.
  4. Dआकृति (shape) को दर्शाने वाली क्लास, जिसकी circle, square और triangle नाम की subclasses हैं।A class representing a shape with subclasses for circle, square, and triangle.

सही उत्तर / Answer: (A)

हल / Solution
डेटाबेस कनेक्शन वाली क्लास अपना काम करने के लिए JDBC (Java Database Connectivity) की क्लासों, जैसे DriverManager और Connection, का उपयोग करती है। वह उनकी methods कॉल करती है, उन्हें अपना हिस्सा नहीं बनाती। इसलिए यह "use-a" यानी डिपेंडेंसी (Dependency) संबंध है। छात्रों की सूची वाला विश्वविद्यालय और इंजन वाली कार "has-a" संबंध हैं। Shape और उसकी subclasses इनहेरिटेंस (Inheritance) यानी "is-a" संबंध हैं। इसलिए विकल्प 1 सही है।
A class that represents a database connection uses JDBC classes such as DriverManager and Connection to do its job. It calls their methods but they are not its parts, so it is a "use-a" (dependency) relationship. A university holding a list of students and a car holding an engine object are "has-a" relationships (aggregation and composition). Shape with Circle, Square and Triangle subclasses is inheritance, an "is-a" relationship.
प्रश्न 6उत्तर + हल
"use-a" संबंध में एक क्लास की कार्यक्षमता (functionality) का उपयोग दूसरी क्लास किस प्रकार करती है?
In a "use-a" relationship, how is the functionality of one class utilized by another class?
  1. Aइनहेरिटेंस (inheritance) के द्वारा।Through inheritance.
  2. Bकम्पोज़िशन (composition) के द्वारा।Through composition.
  3. Cमेथड इनवोकेशन (method invocation) के द्वारा।Through method invocation.
  4. Dडेटा साझा करने (data sharing) के द्वारा।Through data sharing.

सही उत्तर / Answer: (C)

हल / Solution
"use-a" संबंध में एक क्लास दूसरी क्लास की methods कॉल करके अपना काम करवाती है। इसे मेथड इनवोकेशन (method invocation) कहते हैं। जैसे Order क्लास अपनी किसी method के अंदर paymentService.pay() कॉल कर सकती है। इनहेरिटेंस (Inheritance) "is-a" संबंध बनाता है। कम्पोज़िशन (Composition) दूसरे ऑब्जेक्ट को स्थायी हिस्सा बनाकर "has-a" संबंध बनाता है। डेटा साझा करना इस संबंध का तरीक़ा नहीं है। इसलिए विकल्प 3 सही है।
In a "use-a" relationship, one class gets work done by another class by calling its methods. For example, an Order class may call paymentService.pay() inside one of its methods. This is method invocation. Inheritance creates an "is-a" link, and composition makes the other object a permanent part, a "has-a" link. Data sharing between classes is not how this relationship works. So option 3 is correct.
प्रश्न 7उत्तर + हल
Java में "use-a" संबंध क्या है?
What is a "use-a" relationship in Java?
  1. Aयह क्लासों के बीच मज़बूत जुड़ाव (strong coupling) दर्शाता है।It represents a strong coupling between classes.
  2. Bयह ऐसा संबंध दर्शाता है जिसमें एक क्लास दूसरी क्लास की कार्यक्षमता (functionality) का उपयोग करती है।It represents a relationship where one class utilizes the functionality of another class.
  3. Cयह क्लासों के बीच इनहेरिटेंस (inheritance) संबंध दर्शाता है।It represents an inheritance relationship between classes.
  4. Dयह क्लासों के बीच कम्पोज़िशन (composition) संबंध दर्शाता है।It represents a composition relationship between classes.

सही उत्तर / Answer: (B)

हल / Solution
"use-a" संबंध को डिपेंडेंसी (Dependency) भी कहते हैं। इसमें एक क्लास दूसरी क्लास की कार्यक्षमता (functionality) का केवल उपयोग करती है। जैसे किसी method के अंदर उसकी method कॉल करना या उसे parameter में लेना। वह दूसरे ऑब्जेक्ट को अपना स्थायी हिस्सा नहीं बनाती। यह जुड़ाव ढीला (loose coupling) होता है, मज़बूत नहीं। इनहेरिटेंस (Inheritance) "is-a" संबंध है और कम्पोज़िशन (Composition) मज़बूत "has-a" संबंध है। इसलिए विकल्प 2 सही है।
In a "use-a" relationship, also called dependency, one class simply uses the services of another class, for example by calling its methods inside a method or receiving it as a parameter. It does not keep the other object as a permanent part. This link is loose, not strong coupling. Inheritance is an "is-a" relationship, and composition is a strong "has-a" relationship, so option 2 is correct.
प्रश्न 8उत्तर + हल
निम्नलिखित में से कौन-सा संबंध एसोसिएशन (association) का अधिक मज़बूत रूप है?
Which of the following relationships represents a stronger form of association?
  1. Aएग्रीगेशन (Aggregation)Aggregation
  2. Bकम्पोज़िशन (Composition)Composition
  3. Cडिपेंडेंसी (Dependency)Dependency
  4. Dइनहेरिटेंस (Inheritance)Inheritance

सही उत्तर / Answer: (B)

हल / Solution
कम्पोज़िशन (Composition) एसोसिएशन का सबसे मज़बूत रूप है। इसमें हिस्सा (part) पूरी तरह संपूर्ण (whole) का होता है और उसके बिना नहीं रह सकता। जैसे House ऑब्जेक्ट नष्ट हो तो उसके Room भी नष्ट हो जाते हैं। एग्रीगेशन (Aggregation) कमज़ोर "has-a" संबंध है, जिसमें हिस्सा अलग भी रह सकता है। डिपेंडेंसी (Dependency) केवल अस्थायी "uses-a" संबंध है। इनहेरिटेंस (Inheritance) "is-a" संबंध है, एसोसिएशन नहीं।
Composition is the strongest form of association. In it the part object belongs fully to the whole and cannot exist without it; when a House object is destroyed, its Room objects go with it. Aggregation is a weaker "has-a" link where the part can live on its own, like a Department and its Teachers. Dependency is only a temporary "uses-a" link, and Inheritance is an "is-a" relationship, not association.
प्रश्न 9उत्तर + हल
Java में जब दो क्लासें एसोसिएटेड (associated) होती हैं, तो इसका क्या अर्थ है?
In Java, what does it mean when two classes are associated?
  1. Aउनकी सुपरक्लास (superclass) एक ही होनी चाहिए।They must have the same superclass.
  2. Bवे एक जैसे instance variables साझा करती हैं।They share the same instance variables.
  3. Cएक क्लास के ऑब्जेक्ट दूसरी क्लास की methods को कॉल (invoke) कर सकते हैं।Objects of one class can invoke methods of the other class.
  4. Dउन्हें एक ही package में घोषित करना ज़रूरी है।They must be declared within the same package.

सही उत्तर / Answer: (C)

हल / Solution
दो क्लासें तब एसोसिएटेड (associated) कहलाती हैं जब एक क्लास का ऑब्जेक्ट दूसरी क्लास के ऑब्जेक्ट को जानता है। आमतौर पर वह उसका reference रखता है। उसी reference से वह दूसरी क्लास की methods कॉल कर सकता है, इसलिए विकल्प 3 सही है। एक ही सुपरक्लास (superclass) की शर्त इनहेरिटेंस (Inheritance) की बात है। दोनों क्लासें अपने-अपने instance variables रखती हैं, साझा नहीं करतीं। वे अलग-अलग package में भी हो सकती हैं।
Two classes are associated when an object of one class knows an object of the other, usually by holding its reference. Through that reference it can call the other object's methods, so option 3 is correct. Association does not need a common superclass; that is about inheritance. The classes keep their own instance variables and do not share them. They can also live in different packages, if access rules allow.
प्रश्न 10उत्तर + हल
निम्नलिखित में से कौन-सा Java में एसोसिएशन (association) का उदाहरण नहीं है?
Which of the following is NOT an example of association in Java?
  1. Aकार में एक इंजन होता है।A car has an engine.
  2. Bविश्वविद्यालय में छात्र होते हैं।A university has students.
  3. Cएक व्यक्ति अपने माता-पिता से गुण विरासत में पाता है।A person inherits traits from their parents.
  4. Dपुस्तकालय में पुस्तकें होती हैं।A library contains books.

सही उत्तर / Answer: (C)

हल / Solution
एसोसिएशन (Association) वस्तुओं के बीच "has-a" संबंध है। कार में इंजन, विश्वविद्यालय में छात्र और पुस्तकालय में पुस्तकें — तीनों "has-a" संबंध हैं। इसलिए ये एसोसिएशन के रूप हैं, यानी कम्पोज़िशन (Composition) या एग्रीगेशन (Aggregation)। माता-पिता से गुण विरासत में पाना "is-a" वाला विचार है। Java इसे इनहेरिटेंस (Inheritance) से दिखाता है, जिसमें extends keyword लगता है। इसलिए विकल्प 3 एसोसिएशन का उदाहरण नहीं है।
Association is a "has-a" link between objects. A car has an engine, a university has students and a library contains books; each is a "has-a" relationship, so all three are forms of association (composition or aggregation). A person inheriting traits from parents describes an "is-a" idea, which Java models with inheritance using the extends keyword, not association. So option 3 is the one that is not association.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
App खोलिए
प्रश्न 11उत्तर app में
Java में एसोसिएशन (association) के बारे में निम्नलिखित में से कौन-सा कथन सत्य है?
Which of the following statements about association in Java is true?
  1. Aएसोसिएशन "संपूर्ण-अंश" (whole-part) संबंध दर्शाता है।Association implies a "whole-part" relationship.
  2. Bएसोसिएशन से क्लासों के बीच हमेशा मज़बूत जुड़ाव (strong coupling) बनता है।Association always leads to a strong coupling between classes.
  3. Cएसोसिएशन "has-a" संबंध दर्शाता है।Association represents a "has-a" relationship.
  4. Dएसोसिएशन स्वामित्व (ownership) और ज़िम्मेदारी दर्शाता है।Association implies ownership and responsibility.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 12उत्तर app में
निम्नलिखित में से कौन-सा पद दो क्लासों के बीच उस संबंध (association) को सबसे अच्छी तरह बताता है जिसमें एक क्लास दूसरी क्लास का "उपयोग करती है" (uses)?
Which of the following terms best describes the association between two classes where one class "uses" the other?
  1. Aएग्रीगेशन (Aggregation)Aggregation
  2. Bकम्पोज़िशन (Composition)Composition
  3. Cइनहेरिटेंस (Inheritance)Inheritance
  4. Dडिपेंडेंसी (Dependency)Dependency
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 13उत्तर app में
Java में association क्या है?
What is an association in Java?
  1. Aclasses के बीच inheritance का एक रूप।A form of inheritance between classes.
  2. Bअलग-अलग classes के objects के बीच का संबंध।A relationship between objects of different classes.
  3. Cpolymorphism का एक प्रकार।A type of polymorphism.
  4. Dएक class के variables के बीच का जुड़ाव।A connection between variables within a class.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 14उत्तर app में
composition और aggregation के बारे में इनमें से कौन कथन सही है?
Which of the following statements about composition and aggregation is true?
  1. AComposition, aggregation से ज़्यादा मज़बूत संबंध है।Composition is a stronger form of relationship than aggregation.
  2. BAggregation में भीतर का object container के constructor में ही बनाना ज़रूरी है।Aggregation requires the contained object to be created inside the container's constructor.
  3. CAggregation में संबंध चलते-चलते बदला जा सकता है, composition में नहीं।Aggregation allows for dynamic changes in the relationship, whereas composition does not.
  4. DComposition से aggregation की तुलना में हमेशा हल्की coupling बनती है।Composition always leads to a weaker coupling between classes compared to aggregation.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 15उत्तर app में
Java में composition को इनमें से कौन सबसे ठीक बताता है?
Which of the following best describes composition in Java?
  1. Aयह ऐसा "whole-part" संबंध है जिसमें हिस्से पूरे के बिना नहीं रह सकतेIt represents a "whole-part" relationship where the parts cannot exist independently of the whole
  2. Bयह ऐसा "whole-part" संबंध है जिसमें हिस्से पूरे के बिना भी रह सकते हैंIt represents a "whole-part" relationship where the parts can exist independently of the whole
  3. Cयह aggregation से भी हल्का coupling बनाता हैIt implies a weaker coupling between classes compared to aggregation
  4. Dयह classes के बीच दोतरफ़ा संबंध बनाता हैIt implies a bidirectional relationship between classes
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 16उत्तर app में
इनमें से कौन स्थिति aggregation का उदाहरण है?
Which of the following scenarios is an example of aggregation?
  1. Aएक विश्वविद्यालय में विभाग हैं, और हर विभाग में छात्र हैं।A university has departments, and each department has students.
  2. Bकार में इंजन है, और कार के बिना इंजन बेकार है।A car has an engine, and the engine is useless without the car.
  3. Cघर में कमरे हैं, और घर गिराने पर कमरे भी नहीं बचते।A house has rooms, and the rooms are destroyed when the house is demolished.
  4. Dव्यक्ति के पास हृदय है, और व्यक्ति के मरने पर हृदय काम करना बंद कर देता है।A person has a heart, and the heart stops functioning when the person dies.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 17उत्तर app में
aggregation में भीतर रखे object का जीवनकाल क्या होता है?
In aggregation, what happens to the lifetime of the contained object?
  1. Aवह container object के जीवनकाल से स्वतंत्र होता है।It is independent of the lifetime of the container object.
  2. Bcontainer object मिटते ही वह भी मिट जाता है।It is destroyed when the container object is destroyed.
  3. Cवह container object के जीवनकाल के बराबर होता है।It shares the same lifetime as the container object.
  4. Dउसे सिर्फ़ container object ही इस्तेमाल कर सकता है।It can only be accessed by the container object.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 18उत्तर app में
Java में aggregation आम तौर पर कैसे दर्शाया जाता है?
In Java, how is aggregation typically represented?
  1. A"extends" keyword लगाकर।By using the "extends" keyword.
  2. B"implements" keyword लगाकर।By using the "implements" keyword.
  3. Cclass के अंदर "new" से दूसरी class का instance बनाकर, यानी composition से।By using composition with the "new" keyword to create an instance of another class within a class.
  4. Dclasses के बीच "has-a" संबंध रखकर।By using the "has-a" relationship between classes.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 19उत्तर app में
Java में aggregation के बारे में इनमें से कौन कथन सही है?
Which of the following statements about aggregation in Java is true?
  1. AAggregation "whole-part" संबंध दर्शाता है।Aggregation represents a "whole-part" relationship.
  2. BAggregation से classes के बीच हमेशा मज़बूत coupling बनती है।Aggregation always leads to a strong coupling between classes.
  3. CAggregation में container मिटते ही भीतर रखा object भी मिट जाता है।In aggregation the contained object is destroyed as soon as the container is destroyed.
  4. DAggregation मालिकाने और ज़िम्मेदारी का अर्थ देता है।Aggregation implies ownership and responsibility.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 20उत्तर app में
Java में composition के दौरान भीतर रखे object का जीवनकाल क्या होता है?
In Java, what happens to the lifetime of the contained object in composition?
  1. Aवह container object के जीवनकाल के बराबर होता है।It is the same as the lifetime of the container object.
  2. Bवह container object के जीवनकाल से स्वतंत्र होता है।It is independent of the lifetime of the container object.
  3. Ccontainer का constructor पूरा होते ही वह ख़त्म हो जाता है।It ends as soon as the constructor of the container finishes.
  4. Dवह container object के बाहर पहुँच से बाहर रहता है।It is inaccessible outside the container object.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 21उत्तर app में
Java में "has-a" संबंध का मुख्य फ़ायदा क्या है?
What is the primary advantage of using the "has-a" relationship in Java?
  1. Aयह inheritance से code का दोबारा इस्तेमाल कराता है।It allows for code reuse through inheritance.
  2. Bयह dynamic method binding का साधन देता है।It provides a mechanism for dynamic method binding.
  3. Cयह बेहतर encapsulation और मॉड्यूलर design को बढ़ावा देता है।It promotes better encapsulation and modular design.
  4. Dयह abstract data types बनाने देता है।It enables the creation of abstract data types.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 22उत्तर app में
Java में "has-a" संबंध लागू करने के लिए आम तौर पर कौन-सा तरीक़ा अपनाया जाता है?
In Java, which mechanism is commonly used to implement the "has-a" relationship?
  1. AInheritance (वंशानुक्रम)Inheritance
  2. BPolymorphism (बहुरूपता)Polymorphism
  3. CComposition (संघटन)Composition
  4. DEncapsulation (आवरण)Encapsulation
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 23उत्तर app में
Java में "has-a" संबंध के स्वरूप को कौन कथन सबसे ठीक बताता है?
Which statement best describes the nature of the "has-a" relationship in Java?
  1. Aयह parent-child संबंध दर्शाता है।It signifies a parent-child relationship.
  2. Bयह "whole-part" संबंध दर्शाता है।It signifies a "whole-part" relationship.
  3. Cयह behaviour साझा करने वाला संबंध दर्शाता है।It signifies a behaviour sharing relationship.
  4. Dयह हमेशा one-to-many संबंध दर्शाता है।It signifies a one-to-many relationship.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 24उत्तर app में
object-oriented programming में "composition" शब्द किसे कहते हैं?
In the context of object-oriented programming, what does the term "composition" refer to?
  1. Aclasses से objects बनाने की प्रक्रियाThe process of creating objects from classes
  2. Bएक object को दूसरी class के object में बदलने की प्रक्रियाThe process of converting an object into an object of another class
  3. Cinterfaces से classes बनाने की प्रक्रियाThe process of creating classes from interfaces
  4. Dएक object को दूसरे objects के भीतर रखने की प्रक्रियाThe process of containing objects within other objects
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 25उत्तर app में
इनमें से कौन उदाहरण "has-a" संबंध दर्शाता है?
Which of the following examples represents a "has-a" relationship?
  1. ACar class जो Vehicle class से विरासत लेती हैA Car class inheriting from a Vehicle class
  2. BBook class जो Author interface लागू करती हैA Book class implementing an Author interface
  3. CPerson class जो Address class का reference रखती हैA Person class having a reference to an Address class
  4. DDog class जिसमें भौंकने का एक method हैA Dog class having a method to bark
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 26उत्तर app में
Java में "has-a" संबंध कब काम आता है?
When does the "has-a" relationship become useful in Java?
  1. Aजब parent-child संबंध बनाना होWhen establishing parent-child relationships
  2. Bजब interfaces लागू करने होंWhen implementing interfaces
  3. Cजब object के भीतर दूसरा object रखने या मालिकाने का ढाँचा बनाना होWhen modelling object containment or ownership
  4. Dजब polymorphic behaviour तय करना होWhen defining polymorphic behaviour
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 27उत्तर app में
Java में "कार के पास इंजन है" वाक्य किस संबंध को सबसे ठीक दर्शाता है?
In Java, which relationship is best represented by the phrase "car has an engine"?
  1. AInheritance (वंशानुक्रम)Inheritance
  2. BAggregation (समुच्चयन)Aggregation
  3. CComposition (संघटन)Composition
  4. DAssociation (सहयोजन)Association
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 29उत्तर app में
"has-a" संबंध में इनमें से कौन कथन सही है?
In the "has-a" relationship, which of the following statements is true?
  1. Aएक class दूसरी class की subclass होती है।One class is a subclass of another class.
  2. Bएक class दूसरी class का instance अपने अंदर रखती है।One class contains an instance of another class.
  3. Cएक class दूसरी class के साथ methods साझा करती है।One class shares methods with another class.
  4. Dएक class दूसरी class के methods को override करती है।One class overrides methods of another class.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 30उत्तर app में
Java में "has-a" संबंध क्या दर्शाता है?
What does the "has-a" relationship represent in Java?
  1. Aclasses के बीच inheritanceInheritance between classes
  2. Bobjects के बीच associationAssociation between objects
  3. Cmethods के भीतर encapsulationEncapsulation within methods
  4. Dvariables के बीच polymorphismPolymorphism among variables
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
OOPs Concepts - Relationships in java के सभी 58 प्रश्न — उत्तर, हल और अभ्यास

FliQi Question Bank app में topic-वार अभ्यास, कठिनाई-स्तर और आपकी प्रगति।

  • पहला test मुफ़्त
  • हिंदी + English
  • जाँचे हुए उत्तर और हल

यह topic किन परीक्षाओं में आता है

Programmer Java के दूसरे topics

सभी topics