11th Standard Syllabus & Materials
11th Standard
TN 11th Tamil இயற்கை வேளாண்மை,சுற்றுச்சூழல் -செய்யுள் - மனோன்மணீயம் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil என்னுயிர் என்பேன் -துணைப்பாடம் - இசைத்தமிழர் இருவர் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil மொழி கலை -செய்யுள் - ஒவ்வொரு புல்லையும் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil பீடு பெற நில் - இலக்கணம் - பகுபத உறுப்புகள் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil பீடு பெற நில் - துணைப்பாடம் - வாடிவாசல் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil பீடு பெற நில் - செய்யுள் - குறுந்தொகை Important Questions And Answers Study Material - QB365 Set A

Published on: 14/12/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.
The default visibility mode is ________.
public
private
protected
class
2.
When a derived class inherits from multiple base classes is known as ________.
Multilevel
Multiple
Hierarchical
Hybrid
3.
When more than one derived clauses are created from a single base class called ________.
Multiple
Multilevel
Hybrid
Hierarchical
4.
Which of the following statement is true or false?
(i) Inheritance represents read world relationships
(ii) Inheritance does not provide code resuability
(iii) Inheritance does not supports transitivity
(iv) Inheritance support private visibility mode
(i) false, (ii) false, (iii) true, (iv) false
(i) true, (ii) false, (iii) false, (iv) true
(i) true, (ii) false, (iii) false, (iv) true
(i) false, (ii) true, (iii) true, (iv) false
5.
Which of the following class is a power packed class?
sub class
child class
derived class
all of these
6.
Define protected visibility mode.
7.
Write a short note on hierarchical inheritance.
8.
Differentiate containership and Inheritance?
9.
How many bytes will occupy by the class without any declaration?
10.
List the types of inheritance.
11.
Write the derived class using any of the three visibility mode.
12.
What is inheritance and access control?
13.
Can a derived class get access privilege for a private member of the base class? If yes, how?
14.
Explain the uses of private, protected and public inheritance.
15.
Why do you need for inheritance?
16.
Given the following set of definitions. What data
members and functions are directly accessible by
the functions mentioned here?
void inform(void):
class x {
int a;
float b,
void init(void);
public:
char ch; void gett(void)
protected:
doublet;
void get amt (void) ;
friend void A (void);
};
class y: public X
{
intx;
public;
intj;
void readit(void) ;
protected :
void inform (void);
friend void B (void);
};
void display (void);
17.
Write the output of the following program.
# include < iostream >
class person
{
Public:
string profession;
int age;
Person() Profession ("unemployed"),
age (16) {}
void display ( )
{
cout-<<"My profession is:
"<
talk ();
}
void walk()
{ cout-<< "I can walk" <
void talk ()
{cout-<< "I can talk" <
};
Class Teacher: Public Person
{
Public:
void teachrnaths ( )
{cout-<< "I can teach Maths" <
};
Class Player: Public Person
{
Public:
void play football ( )
{ cout-<< "I can play football" <
int main ()
{
Teacher t1;
t1.profession = "Teacher"
t1. age = 24 ;
t1. display ( ) ;
t1. teachmaths( );
Player f1;
f1. profession -= "footballer"
f1. age = 21
f1. display ( ) ;
f1. play football ( ) ;
return 0;
}
18.
Write the output of the following program based on the information given below.
The student Raguram studying in class XII and his roll number is 11201 and the date of birth is 14/01/2002. and he scored 100 marks in all the subjects

# include < iostrearn >
using namespace std;
class student //base class
{
private:
char name[20];
intmo;
public:
void acceptname( )
{
cout<< "\n Enter roll no and name ...";
cin >> rno >> name;
}
void displayname()
{
cout<< "\n Roll no :-"< cout<< "\n Name :-"< } };
class exam : public student
//iderived class with single base class
{
public:
int mark1, mark2 ,mark3,mark4,mark5,mark6;
void acceptmark( )
{
cout << "\n Enter lang,eng,phy,che,csc,mat marks .. ";
cin >> mark1 >>mark2 >> mark3 >> mark4 >> mark5 >> mark6;
}
void displaymark() {
cout<< "\n\t\t Marks Obtained ";
cout<< "\n Language .. "< cout<< "\n English .. "< cout<< "\n Physics .. "< cout<< "\n Chemistry .. "< cout<< "\n Comp.sci .. "< cout<< "\n Maths .. "< }
};
class detail //base classs 2
{
int dd,mm,yy;
char cl[4];
public:
void acceptdob()
{
cout<< "\n Enter date,month,year in digits and class .. ";
cin >> dd >> mm >> yy >> cl;
}
void displaydob()
{
cout << ''n class :-"< cout << "\t\tDOB :,"< }
};
class result: public exam,public detail
//inherits from exam ,which itself is a
//derived class and also from class detail
{
int total;
public:
void showresult( )
{
total=mark1 +mark2+mark3+mark4+mark5+mark6;
cout<<"\nTOTAL MARK SCORED: "< }
};
class detail //base classs 2
{
int dd,mm,yy;
char cl[4];
public:
void acceptdob()
{
cout << "\n Enter date,month,year in digits and class .. ";
cin >> dd >> mm >> yy >> cl;
}
void displaydob( )
{
cout << "\n class :-"< cout << ''\t\tDOB: "< }
};
class result: public exam,public detail
//inherits from exam ,which itself is a
//derived class and also from class detail
{
int total;
public:
void showresult( )
{
total=mark1 +mark2+mark3+mark4+mark5+mark6;
cout << "\nTOTAL MARK SCORED
"< }
};
int main( )
{
result r1;
r1.acceptname( );
//calling base class function using derived class
object
r1.acceptmark ( );
//calling base class which itsel is a derived class
function using its derived class object
int main( )
{
result r1;
r1.acceptname ( );
//calling base class function using derived class
object
rlacceptmark( );
//calling base class which itsel is a derived class
function using its derived class object
r1.acceptdob ( );
cout << "\n\n\t\t MARKS STATEMENT";
r1.displayname ( );
//calling base class function using derived class
object
r1. Ldisplaydob( );
r1.displaymark( );
//calling base class which itsel is a derived class
function using its derived class object
r1.showresult( ); //calling the child class function
return 0;
}
19.
Write the output of the. following program.
#include< iostream >
using namespace std;
class base
{
public:
base( )
{
cout<<"\nConstructor of base class ...";
}
~base( )
{
cout << "\nDestructor of base class .... ";
}
} ;
class derived:public base
{
public:
derived()
{
cout << "\nConstructor of derived ...";
}
~derived( )
{
cout << "\nDestructor of derived ...";
}
};
class derived 1 :public derived
{
public:
derived1( )
{
cout << "n\nConstructor of derivedl ...";
}
~derived 10
{
cout << "\nDestructor of derivedl ...";
}
};
int main ()
{
derived 1 x;
return 0;
}
1.
(b)
private
2.
(b)
Multiple
3.
(d)
Hierarchical
4.
(b)
(i) true, (ii) false, (iii) false, (iv) true
5.
(d)
all of these
6.
When a base class is inherited with protected visibility mode the protected and public members of the base class become 'protected members' of the derived class.
7.
When more than one derived classes are created from a single base class, it is known as Hierarchical inheritance.
8.
| Containership | Inheritance |
| When a class contains objects of another class as its members,· this kind of relationship is called containership. | Inheritance lets you create or define a specialized instance of a class that shares the properties of the class and at the same time adds new features to it. |
9.
A class without any declaration will have 1 byte size. class x {}; X occupies 1 byte.
10.
(i) Single Inheritance
(ii) Multiple Inheritance
(iii) Multilevel Inheritance
(iv) Hierarchical Inheritance
(v) Hybrid Inheritance
11.
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.
12.
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.
13.
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.
14.
(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.
15.
(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.
16.
The function :: inform ( ) can access public data members of classes X and Y and the function display ( ) provided, the definition of; : inform ( ) occurs after the declaration of X, Y and display ( ).
X:: init(), X:: gett ( ), X:: getamti land A () can access all the members of X and :: inform().
Y :: readit ( ), y : : inform ( ) and B ( ) can access all the member ofY, public and protected member of X (the inherited memebrs) and :: inform ( ) (only withe the scope resolutoin operator: : ).
:: display ( ) can access public members of X and Y, ::.
infonn( ) , and A ( ) and B ( ) if only their declarations (A ( ) 's and B ( ) 's occur before display ( ).
17.
Output:
My profession is : Teacher
My age is : 24
I can walk
I can talk
I can teach Maths.
My profession is : football
My age is 21
I can walk.
I can talk.
I can play football.
18.
Enter roll no and name .. 11201 RAGURAM
Enter lang, eng, phy, che, CSC, mat marks .. 100 100 100
100100 100
Enter date, month, year in digits and class .. 14 01
2002 XII
MARKS STATEMENT
Roll no:-11201
Name:- RAGURAM
class:- XII DOB: 14 - 01 -2002
Marks Obtained
Language.. 100
English .. 100
Physics .. 100
Chemistry.. 100
Comp.sci .. 100
Maths .. 100
TOTAL MARK SCORED: 600
19.
Constructor of base class ...
Constructor of derived...
Constructor of derived 1...
Destructor of derived 1...
Destructor of derived...
Destructor of base class ...
11th Standard Syllabus & Materials
11th Standard
TN 11th Tamil பீடு பெற நில் - செய்யுள் - காவடிச்சிந்து Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil பீடு பெற நில் - உரைநடை - மலை இடப்பெயர்கள் : ஓர் ஆய்வு Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil மாமழை போற்றுதும் - துணைப்பாடம் - யானை டாக்டர் Important Questions And Answers Study Material - QB365 Set A
NEW11th Standard
TN 11th Tamil மாமழை போற்றுதும் - செய்யுள் - ஐங்குறுநூறு Important Questions And Answers 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