#### Polymorphism Model Question Paper

11th Standard

Reg.No. :
•
•
•
•
•
•

Computer Science

Time : 02:00:00 Hrs
Total Marks : 50
7 x 1 = 7
1. Which of the following refers to a function having more than one distinct meaning?

(a)

(b)

(c)

(d)

2. Which of the following reduces the number of comparisons in a program?

(a)

(b)

(c)

(d)

(a)

void fun (intx);
void fun (char ch);

(b)

void fun (intx);
void fun (inty);

(c)

void fun (double d);
void fun (char ch);

(d)

void fun (double d);
void fun (inty);

4. Which of the following operator is by default overloaded by the compiler?

(a)

*

(b)

+

(c)

+=

(d)

==

5. #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 ptl(3,2),pt2(5,4);
pt1+pt2;
pt1.show ();
return 0;
}

(a)

pt1+pt2

(b)

Pointpt1(3,2),pt2(5,4)

(c)

pt1.showt);

(d)

return 0;

(a)

3

(b)

4

(c)

only one

(d)

2

7. The number and types of a function's parameter are called

(a)

(b)

(c)

function's signature

(d)

function's prototype

8. 9 x 2 = 18

10. List the operators that cannot be overloaded.

11. Does the return type of a function help in overloading a function?

14. Define polymorphism.

15. What is functions signature?

18. 5 x 3 = 15

23. What is function signature?

24. 2 x 5 = 10

26. Debug the following program
#include < iostream >
using namespace std;
class String
{
public:
charstr[20];
public:
void accept_string
{
cout << "\n Enter String : ";
cin>>str;
}
display_string()
{
cout< }
String operator *(String x) //Concatenating String
{
String s;
strcat(str,str);
strcpy(s.str,str);
goto s;
}
}
int main()
{
String str1, str2, str3;
str1.accept_string();
str2.accept_string();
cout << "\n\n First String is : ";
str1=display_string();
cout << "\n\n Second String is : ";
str2.display_string();
str3=str1+str2;
cout>>"\n\n Concatenated String is : ";
str3.display_string();
return 0;
}