NIOS Class 12 Computer Science Chapter 19 Inheritance Extending Classes

NIOS Class 12 Computer Science Chapter 19 Inheritance Extending Classes Solutions English Medium As Per New Syllabus. to each chapter is provided in the list so that you can easily browse throughout different chapters NIOS Class 12 Computer Science Chapter 19 Inheritance Extending Classes Notes and select need one. NIOS Class 12 Computer Science Question Answers Download PDF. NIOS Study Material of Class 12 Computer Science Notes Paper 330.

NIOS Class 12 Computer Science Chapter 19 Inheritance Extending Classes

Also, you can read the NIOS book online in these sections Solutions by Expert Teachers as per National Institute of Open Schooling (NIOS) Book guidelines. These solutions are part of NIOS All Subject Solutions. Here we have given NIOS Class 12 Computer Science Textbook Solutions, NIOS Senior Secondary Course Computer Science Notes for All Chapter, You can practice these here.

Chapter: 19

Module – 3: Programming in C++

INTEXT QUESTIONS 19.1 

1. Fill in the blanks: 

(a) The derived class can be derived from base class in _______________ , __________, __________ modes. 

Ans: Public, private, protected.

(b) By default base class is visible as _______________ mode in derived class. 

Ans: Private.

(c) When a derived class is derived from more than one base class then the inheritance is called _______________ inheritance. 

Ans: Multiple.

2. State whether the following statements are true or false. 

(a) Inheritance means child receiving certain traits from parents. 

Ans: True.

(b) The default base class is visible as public mode in derived class. 

Ans: False.

(c) When a derived class is derived from more than one base class then the inheritance is called hierarchical inheritance. 

Ans: False.

(d) Abstract class is a base class. 

Ans: True.

(e) Private data of base class can be inherited.

Ans: False.

3. Consider the following class declaration and answer the questions given below:

class zoo 

{ 

    char location [20]; 

    protected; 

              int no_of_animals; 
public; 
         
             void inputdata (char, int);         

             void outputdata ( ); 
}; 
class animal : protected zoo 
{ 
    int tail; 

    protected; 

                int legs; 

public: 

               void readdata (int, int) ; 

               void writedata ( ); 

}; 
class carnivorous : private animal 

{ 

           int paw_size; 

           public : 

                     void fetchdata (int); 

                    void displayed ( ) ; 

};

(a) Name the base class and derived class of the class animal.

Ans: Base class – zoo.

Derived class – animal.

(b) Name the data member(s) that can be accessed from function displayed ( ). 

Ans: legs, paw_size.

(c) Name the data member(s) that can be accessed by an object of carnivorous class. 

Ans: None.

(d) Is the member function output data accessible to the objects of animal class?

Ans: Yes.

TERMINAL EXERCISE 

1. What are the needs of inheritance? 

Ans: The needs of inheritance are: 

(i) The capability to express the inheritance relationship which ensures the closeness with the real world model. 

(ii) Idea of reusability, i.e., the new class can use some of the features of old class (base class). 

(iii) Transitive nature of inheritance, i.e., it can be passed on further.

2. What are the three modes of inheritance? Explain.

Ans: The three modes of inheritance are:

(i) Public Inheritance: Public members of base class remain public in derived class.Protected members remain protected.

(ii) Protected Inheritance: Public and protected members of base class become protected in derived class.

(iii) Private Inheritance: Public and protected members of base class become private in derived class.

3. What is a virtual base class? Explain it by taking an example. 

Ans: Virtual base classes are used for preventing multiple “instances” of a given class appearing in an inheritance.

NEW VIDEO CLASS

Subject Ka Complete Video Solution Dekhein

Step-by-step easy concept explanation aur full questions Answer ke liye watch karein ya app download karein:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top