Get the most accurate UP Board Solutions for Class 12 Computer Science Chapter 16 विरासत here. Updated for the 2026 27 academic session, these solutions are based on the latest UP Board textbooks for Class 12 Computer Science. Our expert-created answers for Class 12 Computer Science are available for free download in PDF format.
Detailed Chapter 16 विरासत UP Board Solutions for Class 12 Computer Science
For Class 12 students, solving UP Board textbook questions is the most effective way to build a strong conceptual foundation. Our Class 12 Computer Science solutions follow a detailed, step-by-step approach to ensure you understand the logic behind every answer. Practicing these Chapter 16 विरासत solutions will improve your exam performance.
Class 12 Computer Science Chapter 16 विरासत UP Board Solutions PDF
बहुविकल्पीय प्रश्न
Question 1. इनहेरिटेंस का प्रयोग कर नवनिर्मित क्लास को क्या कहते हैं?
(a) पेरेण्ट क्लास
(b) बेस क्लास
(c) डिराइव्ड क्लास
(d) इनमें से कोई नहीं
Answer: (c) डिराइव्ड क्लास
In simple words: When we use inheritance to create a new class from an existing class, the newly created class is called a derived class (or child class).
🎯 Exam Tip: Remember that the original class is called the Base class, and the new class created from it is the Derived class.
Question 2. विजिबिलिटी मोड कितने प्रकार के होते हैं?
(a) दो
(b) तीन
(c) चार
(d) पाँच
Answer: (b) तीन प्रकार के–पब्लिक, प्रोटेक्टेड तथा प्राइवेट
In simple words: Visibility modes control who can access the inherited properties. There are three basic ways to do this: public, protected, and private.
🎯 Exam Tip: Clearly list the three visibility modes—public, protected, and private—in your answer to get full marks.
Question 3. किसी कोड की विजिबिलिटी को किसके द्वारा प्राप्त किया जा सकता है?
(a) पॉलीमॉर्फिज्म द्वारा
(b) एनकैप्सूलेशन द्वारा
(c) इनहेरिटेंस द्वारा
(d) ‘a’ और ‘c’ दोनों
Answer: (c) इनहेरिटेंस द्वारा
In simple words: Inheritance lets us reuse existing code and decide how visible or accessible that code should be in the new class.
🎯 Exam Tip: Inheritance is the primary mechanism in object-oriented programming for achieving code reusability and managing member visibility.
Question 4. दो बेस क्लास से एक डिराइव्ड क्लास बनाई जाए, तो यह किसका प्रकार है?
(a) हाइब्रिड इनहेरिटेंस
(b) सिंगल इनहेरिटेंस
(c) मल्टीपल इनहेरिटेंस
(d) हाइरार्किकल इनहेरिटेंस
Answer: (c) मल्टीपल इनहेरिटेंस
In simple words: When one child class inherits features from two or more parent classes at the same time, it is called multiple inheritance.
🎯 Exam Tip: Do not confuse multiple inheritance (one child, many parents) with multilevel inheritance (grandparent to parent to child).
Question 5. निम्नलिखित में से कौन-सा इनहेरिटेंस का प्रकार नहीं है?
(a) सिंगल
(b) पैरेण्ट
(c) मल्टीपल
(d) मल्टीलेवल
Answer: (b) पैरेण्ट
In simple words: Parent is a term used to describe a class itself, but it is not a name of any inheritance type like single, multiple, or multilevel.
🎯 Exam Tip: Learn the five main types of inheritance: Single, Multiple, Multilevel, Hierarchical, and Hybrid to easily solve classification questions.
Question 6. एक बेस क्लास से एक से अधिक चाइल्ड क्लास बनाने की प्रक्रिया किस इनहेरिटेंस का उदाहरण है?
(a) हाइरार्किकल
(b) मल्टीपल
(c) मल्टीलेवल
(d) हाइब्रिड
Answer: (a) हाइरार्किकल
In simple words: Hierarchical inheritance is like a family tree where one parent has more than one child, meaning many child classes inherit from a single base class.
🎯 Exam Tip: Think of hierarchical inheritance as a tree structure branching downwards from a single root class.
अति लघु उत्तरीय प्रश्न
Question 1. डिराइव्ड क्लास क्या होती है?
Answer: इनहेरिटेंस में हम एक क्लास से दूसरी क्लास को इनहेरिट कर सकते हैं। इस प्रकार इनहेरिट क्लास में पहली क्लास के गुण उपस्थित होते हैं। इसके अतिरिक्त कुछ अन्य गुण भी होते हैं। इनहेरिट हुई क्लास को ही डिराइव्ड क्लास कहते हैं। यह क्लास पुरानी क्लास की सभी विशेषताओं को प्राप्त करती है।
In simple words: A derived class is a new class created from an existing class. It automatically gets all the features of the old class and can add its own new features.
🎯 Exam Tip: Clearly mention that a derived class inherits properties from the base class and can also have its own unique members.
Question 2. विजिबिलिटी मोड के नाम लिखिए।
Answer: विजिबिलिटी मोड के नाम इस प्रकार हैं:
(i) public एक्सेस स्पेसिफायर
(ii) protected एक्सेस स्पेसिफायर
(iii) private एक्सेस स्पेसिफायर
ये स्पेसिफायर यह निर्धारित करते हैं कि डेटा मेंबर्स किस स्तर तक सुलभ होंगे।
In simple words: The three visibility modes decide who is allowed to view or use the variables and functions of a class.
🎯 Exam Tip: Write down all three access specifiers correctly to score full marks in this very short answer type question.
Question 3. पब्लिक एक्सेस स्पेसिफायर क्या है?
Answer: पब्लिक स्पेसिफायर में बेस क्लास के सभी पब्लिक डाटा डिराइव्ड क्लास में पब्लिक ही रहते हैं। इसी प्रकार प्राइवेट और प्रोटेक्टेड डाटा भी डिराइव्ड क्लास में सामान्यतः प्राइवेट और प्रोटेक्टेड ही रहते हैं। यह डेटा को बाहरी दुनिया के लिए सुलभ बनाने का सबसे आसान तरीका है।
In simple words: Public access means that the members of the base class remain accessible to everyone, including the derived class and external functions.
🎯 Exam Tip: Explain how public members of a base class maintain their public status inside the derived class under public derivation.
Question 4. मल्टीपल इनहेरिटेंस क्या है?
Answer: मल्टीपल इनहेरिटेंस में एक से अधिक बेस क्लास की सहायता से एक डिराइव्ड क्लास बनाई जाती है। यह प्रणाली बहु-स्तरीय विशेषताओं को एक ही वर्ग में समाहित करने में सहायक होती है।
In simple words: Multiple inheritance is when one child class is created by taking properties from two or more parent classes.
🎯 Exam Tip: Draw a simple conceptual diagram with two parent blocks pointing down to one child block to support your text definition.
लघु उत्तरीय प्रश्न I
Question 1. इनहेरिटेंस पर संक्षिप्त टिप्पणी लिखिए।
Answer: पहले से बनी क्लास के गुणों को सम्मिलित कर एक नई क्लास का निर्माण करना इनहेरिटेंस (Inheritance) कहलाता है। इसमें पुरानी क्लास को बेस क्लास (Base class) या पैरेण्ट क्लास (Parent class) कहते हैं तथा नवनिर्मित क्लास को डिराइव्ड क्लास (Derived class) या चाइल्ड क्लास (Child class) कहते हैं। यह वस्तु-उन्मुख प्रोग्रामिंग (OOP) का एक अत्यंत महत्वपूर्ण सिद्धांत है जो कोड की पुनरावृत्ति को रोकता है।
In simple words: Inheritance is a way to create a new class by using the code and features of an already existing class, saving us from writing the same code again.
🎯 Exam Tip: Use correct terminology like 'Base class' and 'Derived class' and draw a clean tree diagram to represent inheritance to secure maximum marks.
Question 2. इनहेरिटेंस का प्रयोग करने से क्या-क्या लाभ होते हैं?
Answer: इनहेरिटेंस द्वारा निम्नलिखित लाभ होते हैं:
(i) इनहेरिटेंस का प्रयोग करने से कोड ज्यादा लम्बा नहीं होता।
(ii) इससे एक ही कोड को दोबारा प्रयोग किया जा सकता है।
(iii) इनहेरिटेंस के द्वारा कोड को आसानी से मैनेज किया जा सकता है।
(iv) यह मेमोरी में स्पेस को बचाता है।
इन सभी लाभों के कारण सॉफ्टवेयर विकास की गति और दक्षता बहुत बढ़ जाती है।
In simple words: Using inheritance saves time and effort because we can reuse existing code, which keeps our programs smaller, organized, and memory-efficient.
🎯 Exam Tip: List at least four distinct benefits like reusability and memory efficiency in neat points as shown above.
Question 3. इनहेरिटेंस के किन्हीं दो प्रकारों पर संक्षिप्त टिप्पणी लिखिए।
Answer: इनहेरिटेंस मुख्य रूप से पाँच प्रकार (सिंगल, मल्टीपल, मल्टीलेवल, हाइरार्किकल व हाइब्रिड) के होते हैं। किन्हीं दो इनहेरिटेंस पर संक्षिप्त टिप्पणी नीचे दी गई है:
(i) मल्टीलेवल इनहेरिटेंस (Multilevel Inheritance): जिस प्रकार सिंगल इनहेरिटेंस में एक बेस क्लास से एक डिराइव्ड क्लास बनाई जाती है। कभी-कभी डिराइव्ड क्लास से भी एक अन्य क्लास बनाई जा सकती है अर्थात् डिराइव्ड क्लास पुनः एक बेस क्लास की तरह कार्य करे, तो इस प्रकार के इनहेरिटेंस को मल्टीलेवल इनहेरिटेंस कहते हैं।
(ii) हाइरार्किकल इनहेरिटेंस (Hierarchical Inheritance): यह सिंगल इनहेरिटेंस का विकसित रूप है। हाइरार्किकल इनहेरिटेंस में हम एक बेस क्लास से एक से अधिक डिराइव्ड क्लास बना सकते हैं। यह वर्गीकरण को अधिक प्राकृतिक और संगठित बनाता है।
In simple words: Multilevel inheritance is like a family chain (Grandparent -> Parent -> Child), whereas Hierarchical inheritance is like one parent class having multiple child classes.
🎯 Exam Tip: Name all 5 types first, then write clear explanations for the asked two types with simple line drawings to score high.
Question 4. मल्टीपल इनहेरिटेंस तथा मल्टीलेवल इनहेरिटेंस में भेद कीजिए।
Answer: मल्टीपल इनहेरिटेंस तथा मल्टीलेवल इनहेरिटेंस में अन्तर इस प्रकार है:
| मल्टीपल इनहेरिटेंस (Multiple Inheritance) | मल्टीलेवल इनहेरिटेंस (Multilevel Inheritance) |
|---|---|
| एक से अधिक बेस क्लासेज की सहायता से एक डिराइव्ड क्लास बनाई जाती है। | एक डिराइव्ड क्लास पुनः किसी दूसरी डिराइव्ड क्लास के लिए बेस क्लास का कार्य करती है। |
| उदाहरण: | उदाहरण: |
In simple words: Multiple inheritance is when one class has many parents, while multilevel inheritance is a chain like a grandparent passing traits down to a parent, and then to a child.
🎯 Exam Tip: Drawing block diagrams for each type side-by-side inside a tabular comparison is the absolute best way to illustrate the differences clearly.
Question 5. हाइरार्किकल इनहेरिटेंस की व्याख्या, संक्षेप में कीजिए। उदाहरण देकर समझाइए।
Answer: यह सिंगल इनहेरिटेंस का विकसित रूप है। सिंगल इनहेरिटेंस में जहाँ हम एक बेस क्लास से एक डिराइव्ड क्लास बनाते हैं, वहीं हाइरार्किकल इनहेरिटेंस में हम एक बेस क्लास से एक से अधिक डिराइव्ड क्लास बना सकते हैं। यह विभिन्न चाइल्ड क्लासेस को एक ही पेरेंट क्लास के गुण साझा करने की अनुमति देता है।
उदाहरण:
class A
{
protected:
int x, y;
public:
void get()
{
cout << "\n Enter two values \n";
cin >> x >> y;
}
};
class B : public A
{
private:
int m;
};
class C : public A
{
private:
int n;
};
In simple words: Hierarchical inheritance allows multiple child classes to inherit from just one single parent class, just like brothers and sisters inheriting properties from the same parent.
🎯 Exam Tip: When writing the code example, always declare the base class first and then show how multiple derived classes inherit from it using public access.
लघु उत्तरीय प्रश्न II
Question 1. बेस क्लास तथा डिराइव्ड क्लास को समझाने हेतु एक प्रोग्राम लिखिए।
Answer: बेस क्लास तथा डिराइव्ड क्लास को समझाने हेतु प्रोग्राम निम्नलिखित है। यह प्रोग्राम इनहेरिटेंस के मूलभूत सिद्धांत को सरल रूप से प्रदर्शित करता है:
#include<iostream.h>
class Rectangle //Base class
{
protected:
float length, breadth;
public:
void Input()
{
cout << "Enter length: ";
cin >> length;
cout << "Enter breadth: ";
cin >> breadth;
}
};
class Area : public Rectangle //Derived class
{
public:
float calc()
{
return length * breadth;
}
};
void main()
{
cout << "Enter data for find area\n";
Area a;
a.Input();
cout << "Area = " << a.calc() << " square metre\n\n";
}
आउटपुट:Enter data for find area Enter length: 5 Enter breadth: 2 Area = 10 square metre
In simple words: This program has a parent class 'Rectangle' with length and breadth, and a child class 'Area' that inherits them to calculate and print the area of the rectangle.
🎯 Exam Tip: Always write the output of the program at the end, as examiners often check the output to verify if the code is complete and logical.
दीर्घ उत्तरीय प्रश्न
Question 1. उदाहरण सहित मल्टीलेवल इनहेरिटेंस और मल्टीपल इनहेरिटेंस की व्याख्या कीजिए।
Answer: इनहेरिटेंस के ये दोनों प्रकार जटिल प्रोग्रामिंग संरचनाओं को आसान और संक्षिप्त बनाने में सहायक होते हैं।
(i) मल्टीलेवल इनहेरिटेंस (Multilevel Inheritance): जिस प्रकार सिंगल इनहेरिटेंस में एक बेस क्लास से एक डिराइव्ड क्लास बनाई जाती है। कभी-कभी डिराइव्ड क्लास से भी एक अन्य क्लास बनाई जा सकती है अर्थात् डिराइव्ड क्लास पुनः एक बेस क्लास की तरह कार्य करे, तो इस प्रकार के इनहेरिटेंस को मल्टीलेवल इनहेरिटेंस कहते हैं।
उदाहरण:
#include<iostream.h>
class Person
{
protected:
char name[50];
public:
void get1()
{
cout << "Enter your Name\n";
cin >> name;
}
};
class Emp : public Person
{
protected:
int basic;
public:
void get2()
{
cout << "Enter your Basic\n";
cin >> basic;
}
};
class Manager : public Emp
{
protected:
int deptcode;
public:
void display()
{
cout << "Name is " << name;
cout << "\nBasic " << basic;
}
};
void main()
{
Manager obj;
obj.get1();
obj.get2();
obj.display();
getch();
}
आउटपुट:Enter your Name H Enter your Basic 25000 Name is H Basic 25000
(ii) मल्टीपल इनहेरिटेंस (Multiple Inheritance): इस प्रकार के इनहेरिटेंस में एक से अधिक बेस क्लासेज की सहायता से एक डिराइव्ड क्लास बनाई जाती है।
उदाहरण:
#include<iostream.h>
class Expdet
{
protected:
char name[50];
public:
void expr()
{
cout << "Enter your Name" << endl;
cin >> name;
}
};
class Saldet
{
protected:
int salary;
public:
void sal()
{
cout << "Enter your Salary" << endl;
cin >> salary;
}
};
class Promotion : public Expdet, public Saldet
{
public:
void promote()
{
if (salary >= 20000)
cout << "PROMOTED FOR HIGHER GRADE";
else
cout << "CANNOT BE PROMOTED";
}
};
void main()
{
Promotion obj;
obj.expr();
obj.sal();
obj.promote();
}
आउटपुट:Enter your Name J Enter your Salary 23000 PROMOTED FOR HIGHER GRADE
In simple words: Multilevel inheritance is a chain of inheritance (A -> B -> C), whereas Multiple inheritance is when one child class is made directly from multiple independent parent classes (A, B -> C).
🎯 Exam Tip: For long questions on inheritance, always write down separate code examples for both types to ensure you get full marks.
Question 2. इनहेरिटेंस क्या है? इसके कितने प्रकार होते हैं? संक्षेप में समझाइए। (2007) अथवा इनहेरिटेंस से आप क्या समझते हैं? इसके विभिन्न रूपों का वर्णन कीजिए। (2007) अथवा इनहेरिटेंस से क्या आशय है? इसके विभिन्न प्रकारों को समझाइए। (2011)
Answer: पहले से बनी क्लास के गुणों को सम्मिलित कर एक नई क्लास का निर्माण करना इनहेरिटेंस कहलाता है। इसमें पुरानी क्लास को बेस क्लास (Base class) या पेरेंट क्लास (Parent class) कहते हैं तथा नवनिर्मित क्लास को डिराइव्ड क्लास (Derived class) या चाइल्ड क्लास (Child class) कहते हैं। यह प्रोग्रामिंग जटिलता को कम करने का एक अत्यंत शक्तिशाली साधन है।
इनहेरिटेंस के मुख्य रूप से निम्नलिखित पाँच प्रकार होते हैं:
(i) सिंगल इनहेरिटेंस (Single Inheritance): इस प्रकार में एक बेस क्लास से केवल एक ही डिराइव्ड क्लास बनाई जाती है।
प्रारूप:
class derived_class : access_mode base_class
{
// body of derived class
};
(ii) मल्टीपल इनहेरिटेंस (Multiple Inheritance): इसमें एक से अधिक बेस क्लास की सहायता से एक डिराइव्ड क्लास बनाई जाती है।
प्रारूप:
class derived_class : access_mode base_class1, access_mode base_class2
{
// body of derived class
};
(iii) मल्टीलेवल इनहेरिटेंस (Multilevel Inheritance): जब एक डिराइव्ड क्लास पुनः किसी दूसरी डिराइव्ड क्लास के लिए बेस क्लास का कार्य करती है।
प्रारूप:
class derived1 : access_mode base_class
{
// body of derived1 class
};
class derived2 : access_mode derived1
{
// body of derived2 class
};
(iv) हाइरार्किकल इनहेरिटेंस (Hierarchical Inheritance): जब एक ही बेस क्लास से एक से अधिक डिराइव्ड क्लास बनाई जाती हैं।
प्रारूप:
class derived1 : access_mode base_class
{
// body of derived1 class
};
class derived2 : access_mode base_class
{
// body of derived2 class
};
(v) हाइब्रिड इनहेरिटेंस (Hybrid Inheritance): दो या दो से अधिक प्रकार के इनहेरिटेंस के मिश्रण को हाइब्रिड इनहेरिटेंस कहते हैं।
प्रारूप:
class derived1 : access_mode base_class
{
// body of derived1 class
};
class derivedN+1 : access_mode derived1, access_mode derived2
{
// body of derivedN+1 class
};
In simple words: Inheritance is copying properties of an existing class to a new one. It has five types: Single (one to one), Multiple (many to one), Multilevel (chain), Hierarchical (one to many), and Hybrid (mix of these).
🎯 Exam Tip: Listing the standard C++ syntax (प्रारूप) for each inheritance type is highly appreciated by examiners and guarantees maximum marks.
Question 3. विजिबिलिटी मोड (लेबल्स) का वर्णन कीजिए तथा इनहेरिटेंस में उनके उपयोग बताइए। (2010) अथवा private, protected तथा public सदस्यों में भेद कीजिए। (2008)
Answer: विजिबिलिटी मोड इनहेरिटेंस के प्रकार को समझने से पहले विजिबिलिटी मोड को समझना होगा। विजिबिलिटी मोड यह बताता है कि बेस क्लास के कौन-कौन से मेंबर्स डिराइव्ड क्लास में किस प्रकार एक्सेस होंगे। यह डेटा सुरक्षा और एन्कैप्सुलेशन को बनाए रखने के लिए अनिवार्य है।
विजिबिलिटी मोड तालिका नीचे दी गई है:
| एक्सेस मोड (Access Mode) | बेस क्लास मेम्बर (Base Class Member) | डिराइव्ड क्लास मेम्बर (Derived Class Member) |
|---|---|---|
| public | public | public |
| protected | protected | |
| private | Not accessible | |
| protected | public | protected |
| protected | protected | |
| private | Not accessible | |
| private | public | private |
| protected | private | |
| private | Not accessible |
(i) public एक्सेस स्पेसिफायर: इस एक्सेस स्पेसिफायर के प्रयोग करने से बेस क्लास के सभी मैम्बर्स डिराइव्ड क्लास में उसी प्रकार प्रयोग में लाए जाते हैं, जिस प्रकार वे बेस क्लास में डिक्लेयर हैं। प्राइवेट मैम्बर को डिराइव्ड क्लास में सीधे एक्सेस नहीं किया जा सकता।
(ii) protected एक्सेस स्पेसिफायर: प्रोटेक्टेड एक्सेस स्पेसिफायर में, बेस क्लास के सभी प्राइवेट मैम्बर्स डिराइव्ड क्लास में प्राइवेट ही रहते हैं और प्रोटेक्टेड मैम्बर्स भी प्रोटेक्टेड ही रहते हैं, लेकिन बेस क्लास के सभी पब्लिक मैम्बर डिराइव्ड क्लास में प्रोटेक्टेड हो जाते हैं।
(iii) private एक्सेस स्पेसिफायर: प्राइवेट एक्सेस स्पेसिफायर में, बेस क्लास के सभी प्राइवेट मैम्बर्स डिराइव्ड क्लास में प्राइवेट ही रहते हैं और बेस क्लास के सभी प्रोटेक्टेड और पब्लिक मैम्बर डिराइव्ड क्लास में प्राइवेट बन जाते हैं।
In simple words: Access specifiers decide who gets to see and use class variables: Public is open to everyone, Protected is open only to family (derived classes), and Private is strictly locked inside its own class.
🎯 Exam Tip: Carefully memorize the access mode conversion table. Drawing this exact table in your exam will guarantee you full marks on this topic.
Free study material for Computer Science
UP Board Solutions Class 12 Computer Science Chapter 16 विरासत
Students can now access the UP Board Solutions for Chapter 16 विरासत prepared by teachers on our website. These solutions cover all questions in exercise in your Class 12 Computer Science textbook. Each answer is updated based on the current academic session as per the latest UP Board syllabus.
Detailed Explanations for Chapter 16 विरासत
Our expert teachers have provided step-by-step explanations for all the difficult questions in the Class 12 Computer Science chapter. Along with the final answers, we have also explained the concept behind it to help you build stronger understanding of each topic. This will be really helpful for Class 12 students who want to understand both theoretical and practical questions. By studying these UP Board Questions and Answers your basic concepts will improve a lot.
Benefits of using Computer Science Class 12 Solved Papers
Using our Computer Science solutions regularly students will be able to improve their logical thinking and problem-solving speed. These Class 12 solutions are a guide for self-study and homework assistance. Along with the chapter-wise solutions, you should also refer to our Revision Notes and Sample Papers for Chapter 16 विरासत to get a complete preparation experience.
FAQs
The complete and updated UP Board Solutions Class 12 Computer Science Chapter 16 विरासत is available for free on StudiesToday.com. These solutions for Class 12 Computer Science are as per latest UP Board curriculum.
Yes, our experts have revised the UP Board Solutions Class 12 Computer Science Chapter 16 विरासत as per 2026 exam pattern. All textbook exercises have been solved and have added explanation about how the Computer Science concepts are applied in case-study and assertion-reasoning questions.
Toppers recommend using UP Board language because UP Board marking schemes are strictly based on textbook definitions. Our UP Board Solutions Class 12 Computer Science Chapter 16 विरासत will help students to get full marks in the theory paper.
Yes, we provide bilingual support for Class 12 Computer Science. You can access UP Board Solutions Class 12 Computer Science Chapter 16 विरासत in both English and Hindi medium.
Yes, you can download the entire UP Board Solutions Class 12 Computer Science Chapter 16 विरासत in printable PDF format for offline study on any device.