<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Polymorphism &#8211; Samacheer Kalvi</title>
	<atom:link href="https://samacheer-kalvi.com/tag/polymorphism/feed/" rel="self" type="application/rss+xml" />
	<link>https://samacheer-kalvi.com</link>
	<description>Tamilnadu State Board Text Books Solutions for Class 3 to 12</description>
	<lastBuildDate>Sat, 30 Oct 2021 05:34:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
<site xmlns="com-wordpress:feed-additions:1">196241473</site>	<item>
		<title>TN Board 11th Computer Science Important Questions Chapter 15 Polymorphism</title>
		<link>https://samacheer-kalvi.com/tn-board-11th-computer-science-important-questions-chapter-15/</link>
					<comments>https://samacheer-kalvi.com/tn-board-11th-computer-science-important-questions-chapter-15/#respond</comments>
		
		<dc:creator><![CDATA[Prasanna]]></dc:creator>
		<pubDate>Thu, 28 Oct 2021 10:39:59 +0000</pubDate>
				<category><![CDATA[Important Questions]]></category>
		<category><![CDATA[Polymorphism]]></category>
		<category><![CDATA[TN Board 11th Computer Science Important Questions Chapter 15]]></category>
		<guid isPermaLink="false">https://samacheer-kalvi.com/?p=46790</guid>

					<description><![CDATA[TN State Board 11th Computer Science Important Questions Chapter 15 Polymorphism Question 1. Define polymorphism. Answer: The word polymorphism means many forms (poly &#8211; many, morph &#8211; shapes). Polymorphism is the ability of a message or function to be displayed in more than one form. Question 2. In C++ how the polymorphism is achieved. Answer: In C++, polymorphism is achieved through function overloading and operator overloading. Question 3. What does the overloaded function refers to? Answer: An ‘overloaded function’ refers to a function having more than one distinct meaning. Question 4. Define overload resolution. Answer: The process of selecting the most appropriate overloaded function or operator is called overload resolution. Question 5. What is function&#8217;s signature? Answer: The number and types of a function’s parameters are called the function’s signature. Question 6. Write the output for the following code. #include&#60;iostream&#62; using namespace std; class Data { public: void print(int i) { cout&#60;&#60;&#8220;printing int: &#8220;&#60;&#60;i&#60;&#60;endl ; } void print(double f) { cout&#60;&#60;&#8220;printing float: &#8220;&#60;&#60;f&#60;&#60;endl; } void print(char ch) { cout&#60;&#60;&#8220;printing character: &#8220;&#60;&#60;ch&#60;&#60;endl ; } }; int main(void) { Data d; d.print(7); //call print to print integer d.print (50.3) //call print to print float d.print(&#8220;function overloading&#8221;) //call print to print character return &#8230;]]></description>
										<content:encoded><![CDATA[<h2>TN State Board 11th Computer Science Important Questions Chapter 15 Polymorphism</h2>
<p>Question 1.<br />
Define polymorphism.<br />
Answer:<br />
The word polymorphism means many forms (poly &#8211; many, morph &#8211; shapes). Polymorphism is the ability of a<br />
message or function to be displayed in more than one form.</p>
<p>Question 2.<br />
In C++ how the polymorphism is achieved.<br />
Answer:<br />
In C++, polymorphism is achieved through function overloading and operator overloading.</p>
<p>Question 3.<br />
What does the overloaded function refers to?<br />
Answer:<br />
An ‘overloaded function’ refers to a function having more than one distinct meaning.</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 4.<br />
Define overload resolution.<br />
Answer:<br />
The process of selecting the most appropriate overloaded function or operator is called overload resolution.</p>
<p>Question 5.<br />
What is function&#8217;s signature?<br />
Answer:<br />
The number and types of a function’s parameters are called the function’s signature.</p>
<p>Question 6.<br />
Write the output for the following code.<br />
#include&lt;iostream&gt;<br />
using namespace std;<br />
class Data<br />
{<br />
public:<br />
void print(int i)<br />
{<br />
cout&lt;&lt;&#8220;printing int: &#8220;&lt;&lt;i&lt;&lt;endl ;<br />
}<br />
void print(double f)<br />
{<br />
cout&lt;&lt;&#8220;printing float: &#8220;&lt;&lt;f&lt;&lt;endl;<br />
}<br />
void print(char ch)<br />
{<br />
cout&lt;&lt;&#8220;printing character: &#8220;&lt;&lt;ch&lt;&lt;endl ;<br />
}<br />
};<br />
int main(void)<br />
{<br />
Data d;<br />
d.print(7); //call print to print integer<br />
d.print (50.3) //call print to print float<br />
d.print(&#8220;function overloading&#8221;)<br />
//call print to print character<br />
return 0;<br />
}<br />
Answer:<br />
Output:<br />
printing int : 7<br />
printing float : 50.3<br />
printing character : function overloading.</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 7.<br />
Rewrite the following program after removing the syntactical error(s) if any. Underline each correction.<br />
#include[iostream]<br />
Class Employee<br />
{<br />
int Empld=101;<br />
char Ename[20];<br />
public<br />
Employee{ } { }<br />
void Join( )<br />
{<br />
cin&gt;&gt;EmplD;<br />
gets(EName);<br />
}<br />
void list( )<br />
{<br />
cout&lt;&lt;Empld&lt;&lt; &#8220;:&#8221;&lt;&lt;Ename&lt;&lt;endl;<br />
}<br />
};<br />
int main( )<br />
{<br />
Employee E;<br />
Join.E( );<br />
E.List( )<br />
}<br />
Answer:<br />
#include&lt;iostream&gt;<br />
using namespace std;<br />
class Employee<br />
{<br />
int Empld;<br />
char Ename[20];<br />
public:<br />
Employee( )<br />
{<br />
EmpId=101;<br />
}<br />
void Join( )<br />
{<br />
cin&gt;&gt;EmpId;<br />
gets(Ename);<br />
}<br />
void list( )<br />
{<br />
cout&lt;&lt;EmpId&lt;&lt;&#8220;: &#8220;&lt;&lt;Ename&lt;&lt;endl;<br />
}<br />
};<br />
int main( )<br />
{<br />
Employee E;<br />
Join.E ( ) ;<br />
E. List ( ) ;<br />
}</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 8.<br />
Write the definition of a function Fixpay( ) (float Pay[ ],int N), which should modify each element of the array salary pay N elements, as per the following rules.</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-46792" src="https://samacheer-kalvi.com/wp-content/uploads/2021/10/TN-State-Board-11th-Computer-Science-Important-Questions-Chapter-15-Polymorphism-1.png" alt="TN State Board 11th Computer Science Important Questions Chapter 15 Polymorphism 1" width="365" height="198" srcset="https://samacheer-kalvi.com/wp-content/uploads/2021/10/TN-State-Board-11th-Computer-Science-Important-Questions-Chapter-15-Polymorphism-1.png 365w, https://samacheer-kalvi.com/wp-content/uploads/2021/10/TN-State-Board-11th-Computer-Science-Important-Questions-Chapter-15-Polymorphism-1-300x163.png 300w" sizes="(max-width: 365px) 100vw, 365px" /></p>
<p>Answer:<br />
void Fixpay (float pay[ ], int N)<br />
{<br />
for(int i=0; i&lt;N; i:++)<br />
{<br />
if(pay[i]&lt;50000)<br />
pay[i] += pay[i] * 0.35;<br />
else if(pay[i]&gt;50000 &amp;&amp; pay[i] &lt; 100000)<br />
pay[i] += pay[i] * 0.30;<br />
else<br />
pay[i] += pay[i] * 0.20; .<br />
}<br />
}</p>
<p>Question 9.<br />
Find the syntax errors in the following program segment. Give your reason as well,<br />
class MNQ<br />
{<br />
int x = 30;<br />
float y;<br />
MNQ( )<br />
(y = 33;}<br />
~ ( ) { }<br />
int main( )<br />
{<br />
MNQ M1, M2<br />
}<br />
Answer:<br />
The following are the errors in the given program segment:</p>
<p><img decoding="async" class="alignnone size-full wp-image-46791" src="https://samacheer-kalvi.com/wp-content/uploads/2021/10/TN-State-Board-11th-Computer-Science-Important-Questions-Chapter-15-Polymorphism-2.png" alt="TN State Board 11th Computer Science Important Questions Chapter 15 Polymorphism 2" width="363" height="352" srcset="https://samacheer-kalvi.com/wp-content/uploads/2021/10/TN-State-Board-11th-Computer-Science-Important-Questions-Chapter-15-Polymorphism-2.png 363w, https://samacheer-kalvi.com/wp-content/uploads/2021/10/TN-State-Board-11th-Computer-Science-Important-Questions-Chapter-15-Polymorphism-2-300x291.png 300w" sizes="(max-width: 363px) 100vw, 363px" /></p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 10.<br />
Answer the questions (i) and (ii) after going through the following program,<br />
class Match<br />
{<br />
int Time;<br />
public:<br />
Match( ) //Function 1<br />
{<br />
Time = 0;<br />
cout&lt;&lt; &#8220;Match commences&#8221;&lt;&lt;endl;<br />
}<br />
void Details( ) //Function 2<br />
{<br />
cout&lt;&lt; &#8220;Inter Section Basketball Match&#8221;&lt;&lt;endl;<br />
}<br />
Match(int Duration) //Function 3<br />
{<br />
Time = Duration;<br />
cout&lt;&lt; &#8220;Another Match begins now&#8221;«endl;<br />
}<br />
Match(Match &amp; M) //Function 4<br />
{<br />
Time = M.Duration;<br />
cout&lt;&lt; &#8220;Like Previous Match&#8221;&lt;&lt;endl;<br />
}<br />
};<br />
(i) Which category of Constructor-Function 4 belongs to and what is the purpose of using it?<br />
(ii) Write statements that would call the member functions 1 and 3.<br />
Answer:<br />
(i) Copy constructor, it is invoked when an object is created and initialized with values of an already existing object.<br />
(ii) Match M1; //for function 1<br />
Match M2(90); //for function 3</p>
<p>Question 11.<br />
Answer the questions (i) and (ii) after going through the following program.<br />
class Train<br />
{<br />
int Train No, Track;<br />
public:<br />
Train( ); //Function 1<br />
Train (int TN); //Function 2<br />
Train (Train &amp; T); //Function 3<br />
void Allocate( ); //Function 4<br />
void move( ); //Functions 5<br />
void main( )<br />
{<br />
Train T;<br />
}<br />
(i) Out of the following, which of the option is correct for calling function 2?<br />
Answer:<br />
Option 1-Train N(M);<br />
Option 2-Train P(10);</p>
<p>(ii) Name the feature of object oriented programming, which is illustrated by function 1, function 2 and function 3 combined together.<br />
Answer:<br />
(i) Option 2 is correct for calling function 2.<br />
(ii) Function overloading, i.e., Polymorphism.</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 12.<br />
Write a C++ program to find the perimeter of a rectangle using constructor overloading in a class. To find the perimeter of a rectangle using constructor overloading in a class.<br />
Answer:<br />
// constructor declared as outline member function<br />
#include&lt;iostream&gt;<br />
using namespace std;<br />
class Perimeter<br />
int 1, b, p;<br />
public:<br />
Perimeter ( );<br />
Perimeter (int);<br />
Perimeter (int,int);<br />
Perimeter (Perimeters);<br />
void Calculate( );<br />
};<br />
Perimeter::Perimeter( )<br />
{<br />
cout&lt;&lt;&#8220;\n Enter the value of length and breadth&#8221;; cin&gt;&gt;1&gt;&gt;b;<br />
cout&lt;&lt;&#8220;\n\nNonParameterized constructor&#8221;;<br />
}<br />
Perimeter::Perimeter(int a)<br />
{<br />
1=b=a;<br />
cout&lt;&lt;&#8220;\n\n Parameterized constructor with one argument&#8221;;<br />
}<br />
Perimeter::Perimeter(int 11, int b1)<br />
{<br />
cout&lt;&lt;&#8220;\n\n Parameterized constructor with 2 argument&#8221;;<br />
1=11;<br />
b=b1;<br />
}<br />
Perimeter::Perimeter(Perimeter&amp;p)<br />
{<br />
l = p.1;<br />
b = p.b;<br />
cout&lt;&lt;&#8220;\n\n copy constructor&#8221;;<br />
}<br />
void Perimeter::Calculate( )<br />
{<br />
p = 2*(l+b);<br />
cout&lt;&lt;p;<br />
}<br />
int main( )<br />
{<br />
Perimeter Obj ;<br />
cout&lt;&lt;&#8220;\n perimeter of rectangle is&#8221;;<br />
Obj.Calculate( );<br />
Perimeter Obj1(2);<br />
cout&lt;&lt;&#8220;\n perimeter of rectangle&#8221;;<br />
Obj1.Calculate( ) ;<br />
Perimeter Obj2(2, 3);<br />
cout&lt;&lt;&#8220;\n perimeter of rectangle&#8221;;<br />
Obj 2.Calculate( );<br />
Perimeter obj3 (0bj2);<br />
cout,&lt;&lt;&#8220;\n perimeter of rectangle&#8221;;<br />
obj 3.Calculate ( );<br />
return 0;<br />
}<br />
Output:<br />
Enter the value of length and breadth 10 20<br />
Non Parameterized constructor perimeter of rectangle is 60<br />
Parameterized constructor with one argument<br />
perimeter of rectangle 8<br />
Parameterized constructor with 2 argument<br />
perimeter of rectangle 10 copy constructor<br />
perimeter of rectangle 10</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 13.<br />
What is function overloading? Write a C++ program to demonstrate function overloading?<br />
Answer:<br />
The ability of the function to process the message or data in more than one form is called as function overloading.<br />
C++ program to demonstrate function overloading.<br />
#include&lt;iostream&gt;<br />
using namespace std;<br />
void print(inti)<br />
{cout&lt;&lt;&#8220;It is integer&#8221; &lt;&lt;i&lt;&lt;endl;<br />
void print(double f)<br />
{<br />
cout&lt;&lt;&#8220;It is float&#8221;&lt;&lt;f&lt;&lt;endl;<br />
}<br />
void print(string c)<br />
{<br />
cout&lt;&lt;&#8220;It is string&#8221;&lt;&lt;e&lt;&lt;ertdl;<br />
}<br />
int main( )<br />
{<br />
print(10);<br />
print(10.10);<br />
print(&#8220;Ten&#8221;);<br />
return 0;<br />
}<br />
Output:<br />
It is integer 10<br />
It is float 10.1<br />
It is string Ten</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 14.<br />
What do you mean by constructor overloading? Explain with example.<br />
Answer:<br />
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.<br />
Constructor overloading provides flexibility of creating multiple type of objects for a class.<br />
Constructor overloading<br />
#include&lt;iostream&gt;<br />
using namespace std;<br />
class add<br />
{<br />
int num1, num2, sum;<br />
public:<br />
add ( )<br />
{<br />
cout&lt;&lt;&#8220;\n Constructor without parameters&#8230;&#8221;;<br />
num1 = 0;<br />
num2= 0;<br />
sum =0;<br />
}<br />
add(int s1, int s2)<br />
{<br />
cout&lt;&lt;&#8220;\n Parameterized constructor&#8230;<br />
num1=s1;<br />
num2-s2;<br />
sum=0;<br />
}<br />
add(add &amp;a)<br />
{<br />
cout&lt;&lt;&#8220;\h Copy Constructor&#8230;&#8221;;<br />
num1=a.num1;<br />
num2=a.num2;<br />
sum=0;<br />
} _<br />
void getdata( )<br />
{<br />
cout&lt;&lt;&#8220;\nEnter data &#8230;.&#8221;;<br />
cin&gt;&gt;num1 &gt;&gt;num2 ;<br />
}<br />
void addition( )<br />
{<br />
sum=num1 + num2;<br />
}<br />
void putdata( )<br />
{<br />
cout&lt;&lt;&#8220;\n The numbers are&#8230;&#8221;;<br />
cout&lt;&lt;numl&lt;&lt; &#8216;\t&#8217; &lt;&lt;num2; cout&lt;&lt;&#8220;\n The sum of the numbers are. . . &#8220;&lt;&lt; sum;<br />
}<br />
};<br />
int main( )<br />
{<br />
add a,b(10,20), c(b);<br />
a. getdata ( );<br />
a.addition ( );<br />
b. addition ( );<br />
c. addition( );<br />
cout&lt;&lt;&#8220;\n Object a :&#8221;;<br />
a. putdata ( );<br />
cout&lt;&lt;&#8220;\n Object b :&#8221;;<br />
b. putdata( );<br />
cout&lt;&lt;&#8220;\n Object c&#8230;&#8221;;<br />
c. putdata( );<br />
return 0;<br />
}<br />
Output:<br />
Constructor without parameters&#8230;.<br />
Parameterized constructor&#8230;<br />
Copy Constructor &#8230;<br />
Enter data &#8230; 20 30<br />
Object a :<br />
The numbers are.. 20 30<br />
The sum of the numbers are&#8230; 50<br />
Object b :<br />
The numbers are..10 20<br />
The sum of the numbers are&#8230; 30<br />
Object c..<br />
The numbers are..10 20<br />
The sum of the numbers are&#8230; 30</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 15.<br />
Suppose you have a Kitty Bank with an initial amount of ? 500 and you have to add some more amount to it. Create a class &#8216;Deposit&#8217; with a data member named &#8216;amount&#8217; with an initial value of ? 500. Now make three constructors of this class as follows:<br />
(i) Without any parameter &#8211; no amount will be added to the Kitty Bank.<br />
(ii) Having a parameter which is the amount that will be added to the Kitty Bank.<br />
(iii) whenever amount is added an additional equaly amount will be deposited automatically.<br />
Create an object of the &#8216;Deposit&#8217; and display the final amount in the Kitty Bank.<br />
Answer:<br />
#include&lt;iostream&gt;<br />
using namespace std;<br />
class Deposit<br />
{<br />
int amount;<br />
public:<br />
AddAmount( )<br />
{<br />
amount = 500;<br />
}<br />
AddAmount(int a)<br />
{<br />
amount = 500;<br />
amount = a+amount;<br />
}<br />
void Print_amount( )<br />
{<br />
cout&lt;&lt;amount&lt;&lt;endl;<br />
}<br />
} ;<br />
int main( )<br />
{<br />
Deposit a1;<br />
Deposit a2(150);<br />
a1.Print_amount( );<br />
a2.Print_amount ();<br />
return 0;</p>
<p>Question 16.<br />
What is function overloading?<br />
Answer:<br />
The ability of the function to process the message or data in more than one form is called as function overloading.</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 17.<br />
List the operators that cannot be overloaded.<br />
Answer:<br />
The operator that cannot be overload are:<br />
(i) scope operator::<br />
(ii) sizeof<br />
(iii) member selector.<br />
(iv) member pointer selector *<br />
(v) ternary operator ?:</p>
<p>Question 18.<br />
class add{int x; public: add(int)}; Write an outline definition for the constructor.<br />
Answer:<br />
add::add(int y)<br />
{<br />
x=y;<br />
}</p>
<p>Question 19.<br />
Does the return type of a function help in overloading a function?<br />
Answer:<br />
No, the return type of a function does not help in overloading a function.</p>
<p>Question 20.<br />
What is the use of overloading a function?<br />
Answer:<br />
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.</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 21.<br />
What are the rules for function overloading?<br />
Answer:<br />
Rules for function overloading:</p>
<ol>
<li>The overloaded function must differ in the number of its arguments or data types.</li>
<li>The return type of overloaded functions are not considered for overloading same data type.</li>
<li>The default arguments of overloaded functions are not considered as part of the parameter list in function overloading.</li>
</ol>
<p>Question 22.<br />
How does a compiler decide as to which function should be invoked when there are many functions? Give an example.<br />
Answer:<br />
When an overloaded function is called, the compiler determines the mo§t appropriate<br />
definition to use, by comparing the argument types that has been used to call the function with the parameter types specified in the definitions.<br />
Eg:<br />
float area (float radius);<br />
float area (float half, float base, float height) ;<br />
float area (float length , float breadth);</p>
<p>Question 23.<br />
What is operator overloading? Give some example of operators which can be overloaded.<br />
Answer:<br />
The term operator overloading, refers to giving additional functionality to the normal C++ operators like +, + +, -, —, + =, &#8211; =, *.&lt;, &gt;. It is also a type of polymorphism in which an operator is overloaded to give user defined meaning to it.<br />
Eg: &#8216;+’ operator can be overloaded to perform addition on various data types, like for Integer, String(concatenation) etc.</p>
<p>Question 24.<br />
Discuss the benefit of constructor overloading?<br />
Answer:<br />
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.</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 25.<br />
class sale (int cost, discount jpublic: sale(sale &amp;); Write a non-inline definition for constructor specified;<br />
Answer:<br />
sale::sale(sale&amp;s)<br />
{<br />
cost-s.cost;<br />
discount=s.discount;<br />
}</p>
<p>Question 26.<br />
What are the rules for operator overloading?<br />
Answer:<br />
(i) Precedence and Associativity of an Operator cannot be changed.<br />
(ii) No new operators can be created, only existing operators can be overloaded.<br />
(iii) Cannot redefine the meaning of an operator’s procedure.<br />
(iv) Overloaded operators cannot&#8217; have default arguments.<br />
(v) When binary operators are overloaded, the left hand object must be an object of the relevant class.</p>
<p>Question 27.<br />
Answer the question (i) to (v) after going through the following class.<br />
classBook<br />
{<br />
intBookCode;<br />
char Bookname[20];<br />
float fees;<br />
public:<br />
Book( ) //Function X<br />
{<br />
fees=1000;<br />
BookCode=l;<br />
strcpy (Bookname &#8220;C++&#8221;);<br />
}<br />
void display(float C) //Function 2<br />
{<br />
cout«Book code &lt;&lt;&#8220;:&#8221;&lt;&lt; Bookname &lt;&lt; &#8220;:&#8221; &lt;&lt; fees &lt;&lt; endl;<br />
}<br />
~Book( ) //Function 3<br />
{<br />
cout&lt;&lt;&#8220;End of Book Object&#8221;&lt;&lt;endl;<br />
}<br />
Book (intS[ ], char S[ ], float F); //Function 4 };<br />
(i) In the above program, what are Function 1 and Function 4 combined together referred as?<br />
(ii) Which concept is illustrated by Function3? When is this function called/ invoked?<br />
(iii) What is the use of Function 3?<br />
(iv) Write the statements in main to invoke functionl and function 2.<br />
(v) Write the definition for Function 4.<br />
The concept demonstrated is constructor overloading.<br />
(i) Function 1 and Function 4 are called overloaded constructor of the class Book.<br />
(ii) Function 3 is destructor of class Travel. The destructors are called automatically when the objects are destroyed.<br />
(iii) Function 3 is used to deallocate memory.<br />
(iv)<br />
Book B;<br />
B.display(1000);<br />
(v)<br />
Book(int sc, char s[ ], float F)<br />
{<br />
Bookcode = sc; strcpy(Bookname, s);<br />
Fees = F;<br />
}</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 28.<br />
Write the output of the following program<br />
#include&lt;iostream&gt;<br />
using namespace std;<br />
class Seminar<br />
{<br />
int Time;<br />
public:<br />
Seminar( )<br />
{<br />
Time =30;<br />
cout&lt;&lt;&#8220;Seminar starts now&#8221;&lt;,endl;<br />
}<br />
void Lecture( )<br />
{<br />
cout&lt;&lt;&#8220;Lectures in the seminar on&#8221;«endl;<br />
}<br />
Seminar(int Duration)<br />
{<br />
Time =Duration;<br />
cout&lt;&lt;&#8220;Welcome to Seminar&#8221; &lt;&lt;endl;<br />
}<br />
Seminar(Seminar &amp;D)<br />
{<br />
Time =D.Time;<br />
cout&lt;&lt;&#8220;Recap of Previous Seminar Content&#8221;&lt;&lt;endl;<br />
}<br />
~Seminar( )<br />
{<br />
cout&lt;&lt;&#8220;Vote of thanks&#8221;&lt;&lt;endl;<br />
}<br />
};<br />
intmain( )<br />
{<br />
Seminar s1, s2(2), s3(s2);<br />
s1.Lecture( );<br />
return 0;<br />
}<br />
Answer:<br />
Output:<br />
Seminar starts now<br />
Welcome to Seminar<br />
Welcome to Seminar<br />
Lectures in the Seminar on<br />
Vote of thanks<br />
Vote of thanks<br />
Vote of thanks</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 29.<br />
Debug the following program.<br />
#include&lt;iostream&gt;<br />
using namespace std;<br />
class String<br />
{<br />
public:<br />
charstr[20];<br />
public:<br />
void accept_string<br />
{<br />
cout&lt;&lt;&#8220;\n Enter String:&#8221;; cin»str;<br />
}<br />
display_string( )<br />
{<br />
cout&lt;&lt;str;<br />
}<br />
String operator *(String x) //Concatenating String<br />
{<br />
String s;<br />
strcat(str,str);<br />
strcpy(s.str,str);<br />
goto s;<br />
}<br />
}<br />
int main( )<br />
{<br />
String str1, str2, str3;<br />
str1.accept_string( );<br />
str2.accept_string( );<br />
cout&lt;&lt;&#8220;\n\n First String is:&#8221;;<br />
str1=display_string( );<br />
cout&lt;&lt;&#8220;\n\n Second String is:&#8221;;<br />
str2.display_string( );<br />
str3=str1 + str2;<br />
cout&gt;&gt;&#8221;\n\n Concatenated String is:&#8221;;<br />
str3.display_string( );<br />
return 0;<br />
}<br />
Answer:<br />
#include&lt;iostream&gt;<br />
using namespace std;<br />
class String<br />
{<br />
public: char str[20];<br />
public:<br />
void accept_string( )<br />
cout&lt;&lt;&#8220;\n Enter String:&#8221;;<br />
cin&gt;&gt;str;<br />
}<br />
void display_string( )<br />
{<br />
cout&lt;&lt;str;<br />
}<br />
String operator +(String x) //Concatenating String<br />
{<br />
string s<br />
strcat(str,x.str) ; strcpy(s.str, str) ; return s;<br />
};<br />
int main ( )<br />
{<br />
String str1, str2, str3;<br />
strl.accept_string( );<br />
str2.accept_string( );<br />
cout&lt;&lt;&#8220;\n\n First String is:&#8221;;<br />
str1.display_string( );<br />
cout&lt;&lt;&#8220;\n\n Second String is:&#8221;;<br />
str2.display_string();<br />
str3=str1+str2;<br />
cout&gt;&gt;&#8221;\n\n Concatenated String is : &#8220;;<br />
str3.display_string( );<br />
return 0;<br />
}<br />
Output:<br />
Enter String : COMPUTER<br />
Enter String : SCIENCE<br />
First String is : COMPUTER<br />
Second String is : SCIENCE<br />
Concatenated String is : COMPUTER SCIENCE</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 30.<br />
Answer the questions based on the following program.<br />
#include&lt;iostream&gt;<br />
#include&lt;$tring.h&gt;<br />
using namespace std;<br />
class comp<br />
{<br />
public:<br />
chars[10];<br />
void getstring(char str[10])<br />
{<br />
strcpy(s,str);<br />
}<br />
void operator==(comp);<br />
};<br />
void comp::operator==f(comp ob)<br />
{<br />
if(strcmp(s,ob.s)==0)<br />
cout&lt;&lt;&#8220;\nStrings are Equal&#8221;;<br />
else<br />
cout&lt;&lt;&#8220;\nStrings are not Equal&#8221;;<br />
}<br />
int main( )<br />
{<br />
comp ob, ob1;<br />
char string1[10], string2[10];<br />
cout&lt;&lt;&#8220;Enter First String:&#8221;;<br />
cin&gt;&gt;string1;<br />
ob.getstring(string1);<br />
cout&lt;&lt;&#8220;\nEnter Second String:&#8221;;<br />
cin&gt;&gt;string2;<br />
ob1.getstring(string2);<br />
ob==ob1;<br />
return 0;<br />
}<br />
(i) Mention the objects which will have the scope till the end of the program.<br />
(ii) Name the object which gets destroyed in between the program.<br />
(iii) Name the operator which is overloaded and write the statement that invokes it.<br />
(iv) Write out the prototype of the overloaded member function.<br />
(v) What types of operands are used for the overloaded operator?<br />
(vi) Which constructor will get executed? Write the output of the program.<br />
Answer:<br />
(i) ob, ob1<br />
(ii) ob1<br />
(iii) The operator that is overloaded is == The statement that invokes it ob==ob1<br />
(iv) void operator ==(comp ob);<br />
(v) string<br />
(vi) default constructor is executed<br />
Output:<br />
Enter First String : Computer<br />
Enter Second String : Computer<br />
Strings are Equal</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p><span style="color: #0000ff;">Choose the correct answer:</span></p>
<p>Read the following C++ program carefully and answer questions from 1-3.<br />
#include&lt;iostream.h&gt;<br />
class negative<br />
{<br />
int i;<br />
public:<br />
void accept( )<br />
{<br />
cin&gt;&gt;i;<br />
}<br />
void display( )<br />
{<br />
cout&lt;&lt;i;<br />
}<br />
void operator-( )<br />
{<br />
i=-i;<br />
}<br />
};<br />
void main( )<br />
{<br />
negative n2;<br />
n2.accept ( );<br />
-n2;<br />
n2.display( ) ;<br />
}</p>
<p>Question 1.<br />
Identify the operator that is overloaded:<br />
(a) =<br />
(b) &#8211; (Unary)<br />
(c) &#8211; (Binary)<br />
(d) negative<br />
Answer:<br />
(c) &#8211; (Binary)</p>
<p>Question 2.<br />
The prototype of the overloaded member function is:<br />
(a) negative operator &#8211; ( )<br />
(b) void operator minus<br />
(c) void operator &#8211; ( )<br />
(d) void operator &#8211; (negative)<br />
Answer:<br />
(c) void operator &#8211; ( )</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 3.<br />
Which of the following statements invokes the overloaded member function?<br />
(a) Negative n1 ( )<br />
(b) &#8211; &#8211; n2 ( )<br />
(c) n2 +;<br />
(d) &#8211; n2;<br />
Answer:<br />
(d) &#8211; n2;</p>
<p>Question 4.<br />
The mechanism of giving special meaning to an operator is called:<br />
(a) Operator Overloading<br />
(b) Function Overloading<br />
(c) Inheritance<br />
(d) Object<br />
Answer:<br />
(a) Operator Overloading</p>
<p>Question 5.<br />
Which of the following is not a valid function prototype?<br />
(a) void fun (int x) ;<br />
void fun (int y);<br />
(b) void fun (int x, int y);<br />
void fun (int x, float y) ;<br />
(c) int fun(: int x);<br />
void fun (float x) ;<br />
(d) void fun (char x) ;<br />
void fun(char x, int y) ;<br />
Answer:<br />
(a) void fun (int x) ;<br />
void fun (int y);</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 6.<br />
Polymorphism is achieved in C++ through:<br />
(a) Encapsulation<br />
(b) Inheritance<br />
(c) Overloading<br />
(d) Function<br />
Answer:<br />
(c) Overloading</p>
<p>Question 7.<br />
Which of the following operators cannot be overloaded?<br />
(a) +<br />
(b) ++<br />
(c) +=<br />
(d) ::<br />
Answer:<br />
(d) ::</p>
<p>Question 8.<br />
While overloading functions, the possible integral promotions are:<br />
(a) char → int<br />
(b) int → char<br />
(c) both (a) and (b)<br />
(d) none of these<br />
Answer:<br />
(c) both (a) and (b)</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 9.<br />
In operator overloading the operator functions must be defined as:<br />
(a) member function<br />
(b) friend function<br />
(c) either (a) or (b)<br />
(d) neither (a) nor (b)<br />
Answer:<br />
(c) either (a) or (b)</p>
<p>Question 10.<br />
The functionality of ‘+’ operator can be extended to strings through:<br />
(a) operator precedence<br />
(b) operator overloading<br />
(c) operator definition<br />
(d) none of the given<br />
Answer:<br />
(b) operator overloading</p>
<p>Question 11.<br />
The overloaded operator must have at least one operand of:<br />
(a) built-in type<br />
(b) user-defined type<br />
(c) array<br />
(d) derived<br />
Answer:<br />
(b) user-defined type</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 12.<br />
Which one of the following cannot be overloaded?<br />
(a) Constructor<br />
(b) Destructor<br />
(c) Operator<br />
(d) Function<br />
Answer:<br />
(b) Destructor</p>
<p>Question 13.<br />
The __________ arguments of overloaded functions are not considered by the C++ compiler as part of the parameter list.<br />
(a) actual<br />
(b) reference<br />
(c) formal<br />
(d) default<br />
Answer:<br />
(d) default</p>
<p>Question 14.<br />
During overloading of which of the following operators,the left hand object must be an object of the relevant class?<br />
(a) Unary<br />
(b) Binary<br />
(c) Ternary<br />
(d) None of these<br />
Answer:<br />
(b) Binary</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 15.<br />
Which of the following terms means a name having two or more distinct meanings?<br />
(a) Data Abstraction<br />
(b) Encapsulation<br />
(c) Inheritance<br />
(d) Overloading<br />
Answer:<br />
(d) Overloading</p>
<p>Question 16.<br />
The overloaded function definitions are permitted for which of the following data types?<br />
(a) Built in<br />
(b) User defined<br />
(c) Derived<br />
(d) All of these<br />
Answer:<br />
(b) User defined</p>
<p>Question 17.<br />
Which of the following is not true related to function overloading?<br />
(a) Each overloaded function must differ by the number of its formal parameter<br />
(b) The return type of overloaded functions may be the same data type<br />
(c) The default arguments are considered by the C++ compiler as part of the parameter list<br />
(d) Do not use the same function name for two unrelated functions<br />
Answer:<br />
(c) The default arguments are considered by the C++ compiler as part of the parameter list</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 18.<br />
By integral promotions, int data type can be converted into which of the following?<br />
(a) char<br />
(b) double<br />
(c) float<br />
(d) all of these<br />
Answer:<br />
(d) all of these</p>
<p>Question 19.<br />
Integral promotions are purely:<br />
(a) compiler oriented<br />
(b) computer oriented<br />
(c) data oriented<br />
(d) program oriented<br />
Answer:<br />
(a) compiler oriented</p>
<p>Question 20.<br />
In polymorphism, the compiler adopts which strategy to match-function call statement?<br />
(a) Best match<br />
(b) Worst match<br />
(c) Good match<br />
(d) Next match<br />
Answer:<br />
(a) Best match</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 21.<br />
In overloaded function, which are not considered by the C++ compiler as part of the parameter list:<br />
(a) Dummy arguments<br />
(b) Actual parameters<br />
(c) Formal parameters<br />
(d) Default arguments<br />
Answer:<br />
(d) Default arguments</p>
<p>Question 22.<br />
Which operator cannot be overloaded?<br />
(a) ::. size of ? :<br />
(b) : size of + *<br />
(c) + &#8211; * 7 :<br />
(d) + . ? size of<br />
Answer:<br />
(a) ::. size of ? :</p>
<p>Question 23.<br />
Which of the following C++ operators can be overloaded ?<br />
(a) ::<br />
(b) .<br />
(c) ?:<br />
(d) +<br />
Answer:<br />
(d) +</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 24.<br />
The function operator( ) is declared in which part of the class ?<br />
(a) public<br />
(b) private<br />
(c) protected<br />
(d) static<br />
Answer:<br />
(a) public</p>
<p>Question 25.<br />
Which of the following statements is false in case of operator overloading?<br />
(a) Only existing operators can be overloaded<br />
(b) The basic definition of an operator can be replaced<br />
(c) The overloaded operator must have at least one operand of user defined type<br />
(d) Binary operators overloaded through member function take one explicit argument.<br />
Answer:<br />
(b) The basic definition of an operator can be replaced</p>
<p>Question 26.<br />
Operator &lt;symbol&gt;( ) must be declared under which access of the class?<br />
(a) private<br />
(b) prptect<br />
(c) public<br />
(d) protected<br />
Answer:<br />
(c) public</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 27.<br />
Which of the following operators can be overloaded?<br />
(a) size of ( )<br />
(b) ::<br />
(c) ++<br />
(d) (.) membership operator<br />
Answer:<br />
(c) ++</p>
<p>Question 28.<br />
In how many ways is polymorphism achieved in C++?<br />
(a) 2<br />
(b) 3<br />
(c) 1<br />
(d) 4<br />
Answer:<br />
(a) 2</p>
<p>Question 29.<br />
How many explicit argument(s) is/are taken by binary operators overloaded through a member function?<br />
(a) One<br />
(b) Two<br />
(c) Three<br />
(d) Six<br />
Answer:<br />
(a) One</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 30.<br />
Polymorphism is achieved through:<br />
(a) function overloading<br />
(b) operator overloading<br />
(c) both (a) and (b)<br />
(d) encapsulation<br />
Answer:<br />
(c) both (a) and (b)</p>
<p>Question 31.<br />
The parameter list in function overloading must differ by:<br />
(a) number of arguments<br />
(b) function name<br />
(c) function size<br />
(d) number of functions<br />
Answer:<br />
(a) number of arguments</p>
<p>Question 32.<br />
The operator that can be overloaded is:<br />
(a) ::<br />
(b) .<br />
(c) sizeof( )<br />
(d) + =<br />
Answer:<br />
(d) + =</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 33.<br />
In C++, each overloaded function must differ either by the number of:<br />
(a) function name<br />
(b) actual parameter<br />
(c) default parameter<br />
(d) formal parameter<br />
Answer:<br />
(d) formal parameter</p>
<p>Question 34.<br />
The ability of the function to process the message or data in more than one form is called as:<br />
(a) function overloading<br />
(b) operator overloading<br />
(c) destructor overloading<br />
(d) data overloading<br />
Answer:<br />
(a) function overloading</p>
<p>Question 35.<br />
Which one of the following operator overload through a member function take one explicit argument?<br />
(a) Unary<br />
(b) Ternary<br />
(c) Binary<br />
(d) Conditional<br />
Answer:<br />
(c) Binary</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 36.<br />
The overloaded operator must have at least how many operand of user defined data type?<br />
(a) Two<br />
(b) One<br />
(c) Three<br />
(d) Four<br />
Answer:<br />
(b) One</p>
<p>Question 37.<br />
The overloaded operator must have atleast one operahd of:<br />
(a) user definded<br />
(b) class<br />
(c) static<br />
(d) Built in data<br />
Answer:<br />
(a) user definded</p>
<p>Question 38.<br />
Which access specifier is used to declare operator () function in operator overloading?<br />
(a) Private<br />
(b) Protected<br />
(c) Public<br />
(d) Unprotected<br />
Answer:<br />
(c) Public</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 39.<br />
The ability of an object to respond differently to different messages is called as:<br />
(a) Encapsulation<br />
(b) Polymorphism<br />
(c) Inheritance<br />
(d) Object<br />
Answer:<br />
(b) Polymorphism</p>
<p>Question 40.<br />
The word ‘poly’ means:<br />
(a) Class<br />
(b) Shape<br />
(c) Many<br />
(d) Constructor<br />
Answer:<br />
(c) Many</p>
<p>Question 41.<br />
In C++ which is achieved through overloading?<br />
(a) Data hiding<br />
(b) Encapsulation<br />
(c) Inheritance<br />
(d) Polymorphism<br />
Answer:<br />
(d) Polymorphism</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 42.<br />
In C++, when binary operators are overloaded through a member function they take how many explicit arguments?<br />
(a) Four<br />
(b) Two<br />
(c) One<br />
(d) Three<br />
Answer:<br />
(c) One</p>
<p>Question 43.<br />
Hierarchical database were primarily used in which computers?<br />
(a) Super<br />
(b) Mainframe<br />
(c) Personal<br />
(d) Micro<br />
Answer:<br />
(b) Mainframe</p>
<p>Question 44.<br />
In C++, double data type can be converted into which data type during integral promotion?<br />
(a) char<br />
(b) int<br />
(c) string<br />
(d) void<br />
Answer:<br />
(b) int</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 45.<br />
In C++, which of the following is achieved through function overloading and operator overloading?<br />
(a) encapsulation<br />
(b) data abstraction<br />
(c) polymorphism<br />
(d) inheritance<br />
Answer:<br />
(c) polymorphism</p>
<p>Question 46.<br />
Identify the odd man out:<br />
(a) Scope operation (::)<br />
(b) Sizeof<br />
(c) Member selector (.)<br />
(d) Plus (+)<br />
Answer:<br />
(d) Plus (+)</p>
<p>Question 47.<br />
Identify the incorrect statement in operator overloading:<br />
(a) Precedence and Associativity can be changed.<br />
(b) No new operators can be created only existing operators can be overloaded.<br />
(c) Cannot redefine the meaning of an operator’s precedence.<br />
(d) Overloaded operators cannot have default arguments.<br />
Answer:<br />
(a) Precedence and Associativity can be changed.</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 48.<br />
Identify the incorrect statement:<br />
(a) Overloaded function refers to function having only one meaning.<br />
(b) A class can have more than one constructor with different signature.<br />
(c) ?: operator can be overloaded.<br />
(d) Function overloaded makes the program to execute slower.<br />
Answer:<br />
(b) A class can have more than one constructor with different signature.</p>
<p>Question 49.<br />
Which of the following refers to a function having more than one distinct meaning?<br />
(a) Function overloading<br />
(b) Member overloading<br />
(c) Operator overloading<br />
(d) Operations overloading<br />
Answer:<br />
(a) Function overloading</p>
<p>Question 50.<br />
Which of the following reduces the number of Comparisons in a program?<br />
(a) Operator overloading<br />
(b) Operations overloading<br />
(c) Function overloading<br />
(d) Member overloading<br />
Answer:<br />
(c) Function overloading</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 51.<br />
void dispchar(char ch=‘$’,int size=10)<br />
{<br />
for (int i=1; i&lt;=size; i++) ;<br />
cout&lt;&lt;Ch;<br />
}<br />
How will you invoke the function dispchar( ) for the following input?<br />
To print $ for 10 times<br />
(a) dispchar( );<br />
(b) dispchar(ch,size);<br />
(c) dispchar($,10);<br />
(d) dispchar(‘$’, 10 times);<br />
Answer:<br />
(a) dispchar( );</p>
<p>Question 52.<br />
Which of the following is not true with respect to function overloading?<br />
(a) The overloaded functions must differ in their signature.<br />
(b) The return type is also considered for overloading a function.<br />
(c) The default arguments of overloaded functions are not considered for Overloading.<br />
(d) Destructor function cannot be overloaded.<br />
Answer:<br />
(b) The return type is also considered for overloading a function.</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 53.<br />
Which of the following is invalid prototype for function overloading?<br />
(a) void fun (int x); void fun (char ch);<br />
(b) void fun (int x); void fun (int y);<br />
(c) void fun (double d); void fun (char ch);<br />
(d) void fun (double d); void fun (int y);<br />
Answer:<br />
(b) void fun (int x); void fun (int y);</p>
<p>Question 54.<br />
Which of the following function(s) combination cannot be considered as overloaded function(s) in the given snippet?<br />
void print(char A,int B); // F1<br />
void printprint (int A, float B) ; // F2<br />
void Print(int P=10); // F3<br />
void print( ); // F4<br />
(a) F1,F2,F3,F4<br />
(b) F1,F2,F3<br />
(c) F1,F2,F4<br />
(d) F1,F3,F4<br />
Answer:<br />
(a) F1,F2,F3,F4</p>
<p>Question 55.<br />
Which of the following operator is by default<br />
overloaded by the compiler?<br />
(a) *<br />
(b) +<br />
(c)+=<br />
(d) = =<br />
Answer:<br />
(d) = =</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Based on the following program answer the questions (8) to (10)<br />
#include&lt;iostream&gt;<br />
using namespace std;<br />
class Point<br />
{<br />
private:<br />
int x, y;<br />
public: .<br />
Point (int x1,int y1)<br />
{ ,<br />
x=x1;y=y1;<br />
}<br />
void operatort+(Point &amp;pt3);<br />
void show( )<br />
{<br />
cout&lt;&lt;&#8220;x=&#8221;&lt;&lt;x&lt;&lt;&#8220;, y=&#8221;&lt;&lt;y;<br />
}<br />
};<br />
void Point::operator+(Point &amp;pt3)<br />
{<br />
x += pt3.x;<br />
y += pt3.y;<br />
}<br />
int main( )<br />
Point pt1 (3, 2), pt2(5, 4);<br />
pt1 + pt2;<br />
pt1.show ( );<br />
return 0;<br />
}</p>
<p>Question 56.<br />
Which of the following operator is overloaded?<br />
(a) +<br />
(b) operator<br />
(c) ::<br />
(d) =<br />
Answer:<br />
(a) +</p>
<p>Question 57.<br />
Which of the following statement invoke operator overloading?<br />
(a) pt1 + pt2;<br />
(b) point pt1 (3,2), pt2(5,4);<br />
(c) ptl.show( );<br />
(d) return 0;<br />
Answer:<br />
(a) pt1 + pt2;</p>
<p><img decoding="async" src="https://samacheer-kalvi.com/wp-content/uploads/2021/08/Samacheer-Kalvi.png" alt="Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 15 Polymorphism" width="147" height="12" /></p>
<p>Question 58.<br />
What is the output for the above program?<br />
(a) x = 8, y = 6<br />
(b) x = 14, y = 14<br />
(c) x = 8, y = 6<br />
(d) x = 5, y = 9<br />
Answer:<br />
(a) x = 8, y = 6</p>
<h4><a href="https://samacheer-kalvi.com/tn-board-11th-computer-science-important-questions/">TN Board 11th Computer Science Important Questions</a></h4>
]]></content:encoded>
					
					<wfw:commentRss>https://samacheer-kalvi.com/tn-board-11th-computer-science-important-questions-chapter-15/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">46790</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 

Served from: samacheer-kalvi.com @ 2026-08-25 01:45:53 by W3 Total Cache
-->