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: 09/09/2019
Polymorphism
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.
What is the use of overloading a function?
2.
class add{int x; public: add(int)}; Write an outline definition for the constructor.
3.
4.
class sale ( int cost, discount ;public: sale(sale &); Write a non inline definition for constructor specified;
5.
Discuss the benefits of constructor overloading?
6.
What is operator overloading? Give some example of operators which can be overloaded.
7.
Answer the questions based on the following program
#include < iostream >
#include < string.h >
using namespace std;
class comp {
public:
char s[10];
void getstring(char str[10])
{
strcpy(s,str);
}
void operator==(comp);
};
void comp::operator==(comp ob)
{
if(strcmp(s,ob.s)==0)
cout << "\nStrings are Equal";
else
cout << "\nStrings are not Equal";
}
int main()
{
comp ob, ob1;
char string1[10], string2[10];
cout << "Enter First String:";
cin>>string1;
ob.getstring(string1);
cout << "\nEnter Second String:";
cin >> string2;
ob1.getstring(string2);
ob==ob1;
return 0;
}
(i) Mention the objects which will have the scope till the end of the program.
(ii) Name the object which gets destroyed in between the program
(iii) Name the operator which is over loaded and write the statement that invokes it.
(iv) Write out the prototype of the overloaded member function
(v) What types of operands are used for the overloaded operator?
(vi) Which constructor will get executed? Write the output of the program.
8.
What are the rules for operator overloading?
9.
#include< iostream >
using namespace std;
class Point {
private:
int x, y;
public:
point(int x1,int y1)
{
x=x1;y=y1;
}
void operator+(Point & pt3);
void showO {cout << "x=" << x << " ,y=" << y;}
};
void Point::operator+(point & pt3)
{
x + =pt3.x;
y+=pt3.y;
}
int main ()
{
point pt1(3,2),pt2(5,4);
pt1+pt2;
pt1.show ();
return 0;
}
What is the output for the above program?
x=8,y=6
x=14,y=:14
x = 8, y =6
= x =5, y = 9
10.
Which of the following operator is by default overloaded by the compiler?
*
+
+=
==
11.
Which of the following is invalid prototype for function overloading
void fun (intx);
void fun (char ch);
void fun (intx);
void fun (inty);
void fun (double d);
void fun (char ch);
void fun (double d);
void fun (inty);
12.
Which of the following reduces the number of comparisons in a program?
Operator overloading
Operations overloading
Function Overloading
Member overloading
13.
1.
Function overloading is not only implementing polymorphism but also reduces the number of comparisons in a program and makes the program to execute faster. It also helps the programmer by reducing the number of function names to be remembered.
2.
add (int temp)
{
x = temp;
}
3.
4.
class sale
{
int cost, discount;
public:
sale (sale&);
};
// non inline constructor
sale: : sale(sale&s)
{
cost = s.cost;
discount = s.discount;
}
5.
Function overloading can be applied for constructors, as constructors are special functions of classes. A class can have more than one constructor with different signature. Constructor overloading provides flexibility of creating multiple type of objects for a class.
1. Memory is allocated for the objects.
2. Initialisation for the objects.
6.
The term operator overloading, refers to giving additional functionality to the normal C++ operators like +, ++, -, --, +=, -=, *, <, >.It is also a type of polymorphism in which an operator is overloaded to give user defined meaning to it.
For example ¹+'operator can be overloaded to perform addition on various data types, like for Integer, String (concatenation) etc.
7.
(i) Objects: ob and obl of main ()
(ii) object ob of void operator==(comp ob);
(iii) Overloaded operator: ===
Statement that invokes: ob == obl;
(iv) void operator==(comp ob):
(v) operands used are the objects of the class comp
(vi) The default constructor generated by the compiler will be executed.[comp();]
| Output 1 | Output 2 |
| Enter first string: hello Enter second string: hello String are equal |
Enter first string: hello Enter second string: fine String are not equal. |
8.
Following are some rules to be followed while implementing operator overloading.
(i) Precedence and Associativity of an operator cannot be changed.
(ii) No new operators can be created, only existing operators can be overloaded.
(iii) Cannot redefine the meaning of an operator's procedure. You cannot change how integers are added. Only additional functions can be to an operator.
(iv) Overloaded operators cannot have default arguments.
(v) When binary operators are overloaded, the left hand object must be an object of the relevant class.
9.
(a)
x=8,y=6
10.
(d)
==
11.
(a)
void fun (intx);
void fun (char ch);
12.
(b)
Operations overloading
13.
(a)
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