⟩ In C++ if program executed successfully, following value will be returned to the calling process, if nothing specified in return statement? a) 0 b) 1 c) -1 d) 2
a) 0
a) 0
Can you please explain operator overloading?
Explain function overloading?
What is overloading template?
Tell me what is operator overloading in C++?
Can you please explain the difference between overloaded functions and overridden functions?
How many parameters does a conversion operator may take? a) 0 b) 1 c) 2 d) as many as possible
What is the return type of the conversion operator? a) void b) int c) float d) no return type
Why we use the "dynamic_cast" type conversion? a) result of the type conversion is a valid b) to be used in low memory c) result of the type conversion is a invalid d) None of the mentioned
What is the output of this program?
#include <iostream>
using namespace std;
class sample1
{
float i, j;
};
class sample2
{
int x, y;
public
sample2 (int a, int b)
{
x = a;
y = b;
}
int result()
{
return x + y;
}
};
int main ()
{
sample1 d;
sample2 * padd;
padd = (sample2*) &d;
cout < result();
return 0;
}
a) 20
b) runtime error
c) random number
d) c or bWhat is the output of this program?
#include <iostream>
#include <cmath>
using namespace std;
class Complex
{
private
double real;
double imag;
public
Complex(double r = 0.0, double i = 0.0) real(r), imag(i)
{}
double mag()
{
return getMag();
}
operator double ()
{
return getMag();
}
private
double getMag()
{
return sqrt(real * real + imag * imag);
}
};
int main()
{
Complex com(3.0, 4.0);
cout << com.mag();
cout << com;
return 0
}
a) 5 5
b) 4 5
c) 6 6
d) None of the mentioned