11th Standard Syllabus & Materials
11th Standard
TN 11th English Supplementary - 3 - The First Patient (Play) Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th English Prose - 3 - Forgetting Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th English Prose - 2 - The Queen of Boxing Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th English Poem - 1 - Once Upon A Time Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th English Prose - 1 - The Portrait of a Lady Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th Computer Applications Tamil Computing Sample Question Papers Study Material - QB365 Set A

Published on: 14/10/2019
Inheritance
Download Tamil Nadu 11th Standard Computer Science question papers, model tests, one-mark questions, important questions, and public exam papers in PDF format. Free study materials and answer keys for TN State Board students.
Questions + Answers key
Take MCQ Computer Science Test

1.
Write the derived class using any of the three visibility mode.
2.
What is inheritance and access control?
3.
Can a derived class get access privilege for a private member of the base class? If yes, how?
4.
Write the output of the following program.
#include< iostream >
using namespace std;
class T
{
public:
int x;
void foot()
{
x = 6; // same as this->x = 6;
this ->x = 5; // explicit use of this ->
cout<
}
void foo(int x) // parameter x shadows the member
with the same name
{
this->x = x; // unqualified x refers to the
parameter.'this->' required for disambiguation
cout<< endl << x <<" "<
}};
int main()
{
T t1,t2;
t1.foot();
t2.food();
}
5.
Write the output of the following program.
//Implementation of Single Inheritance using public
visibility mode
#include < iostream >
using namespace std;
class Shape
{
private:
int count;
protected:
int width;
int height;
public:
void setWidth(int w)
{
width=w;
}
void setHeight(int h)
{
height=h;
}
};
class Rectangle: publicShape
{
public:
int getArea()
{
return (width * height);
}
};
int main()
{
Rectangle Rect;
Rect.setWidth( 5);
Rect.setHeight(7);
II Print the area of theobject.
cour<< "Total area: "<< Rect.getArea() << endl;
return ();
}
6.
In what situation shadowing base class function inderived class arises? How will you resolve the situation?
7.
Explain the uses of private, protected and public inheritance.
8.
Why do you need for inheritance?
9.
What do you mean by overriding?
10.
What are the points to be noted while deriving a new class?
1.
Classes can be derived using any of the three visibility mode:
1. In a public base class, public and protected members of the base class remain public and protected members of the derived class.
2. In a protected base class, public and protected members of the base class are protected members of the derived class.
3. In a private base class, public and protected members of the base class become private members of the derived class.
2.
When you declare a derived class, a visibility mode can precede each base class in the base list of the derived class. This does not alter the access attributes of the individual members of a base class, but allows the derived class to access the members of a base class with restriction. Classes can be derived using any of the three visibility mode:
1. In a public base class, public and protected members of the base class remain public and protected members of the derived class
2. In a protected base class, public and protected members of the base class are protected members of the derived class
3. In a private base class, public and protected members of the base class become private members of the derived class.
In all these cases, private members of the base class remain private and cannot be used by the derived class. However it can be indirectly accessed by the derived class using the public or protected member function of the base class since they have the access privilege for the private members of the base class.
3.
A derived class does not get direct access privilege for a private member of its base class, however, it always can access(indirectly) the private members of its base class through an inherited function that is accessing these members.
4.
Output:
55
55
5.
Output:
Total area: 35.
6.
In case of inheritance there are situations where the member function of the base class and derived classes have the same name. If the derived class object calls the overloaded member function it leads confusion to the compiler as to which function is to be invoked. The derived class member function have higher priority than the base class member function. This shadows the member function of the base class which has the same name like the member function of the derived class. The scope resolution operator resolves this problem.
7.
(i) Private inheritance should be used when you want the features of the base class to be available to the derived class but not to the classes that are derived from the derived class.
(ii) Protected inheritance should be used when features of base class to be available only to the derived class members but not to the outside world.
(iii) Public inheritance can be used when features of base class to be available the derived class members and also to the outside world.
8.
(i) Inheritance is an important feature of object oriented programming used for code reusability. It is a process of creating new classes called derived classes, from the existing or base classes.
(ii) Inheritance allows us to inherit all the code (except declared as private) of one class to another class. The class to be inherited is called base class or parent class and the class which inherits the other class is called derived class or child class.
(iii) The derived class is a power packed class, as it can add additional attributes and methods and thus enhan e its functionality.
9.
When a derived class member function has the same name as that of its base class member function, the derived class member function shadows/hides the base class's inherited function. This situation is called function overriding.
10.
The following points should be observed for defining the derived class:
(i) The keyword class has to be used.
(ii) The name of the derived class is to be given after the keyword class.
(iii) A single colon.
(iv) The type of derivation (the visibility mode), namely private, public or protected. If no visibility mode is specified, then by default the visibility mode is considered as private.
(v) The names of all base classes (parent classes) separated by comma.
11th Standard Syllabus & Materials
11th Standard
TN 11th Computer Applications Computer Ethics and Cyber Security Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th Computer Applications JavaScript Functions Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th Computer Applications Control Structure in JavaScript Sample Question Papers Study Material - QB365 Set A
NEW11th Standard
TN 11th Computer Applications Introduction to JavaScript Sample Question Papers Study Material - QB365 Set A
Tamilnadu Stateboard 11th Standard Subjects

Maths

Commerce

Economics

Biology

Business Maths and Statistics

Accountancy

Computer Science

Physics

Chemistry

Maths

Biology

Economics

Physics

Chemistry

History

Business Maths and Statistics

Computer Science

Accountancy

Computer Applications

History

Computer Technology

Commerce

Computer Applications

Computer Technology

Tamil

English

French
Tamilnadu Stateboard Standards