C++ | Function Overloading

Q.1.
Give the output of the following:

#include<iostream>
using namespace std;
 
int fun(int x = 0, int y = 0, int z=10)
{  return (x + y + z); }
 
int main()
{
   cout << fun(100);
   return 0;
}

A. 0
B. 110
C. 10
D. Error

Q.2
Give output of the following:

#include<iostream>
using namespace std;
 
int fun(int x = 0, int y = 0, int z)
{  return (x + y + z); }
 
int main()
{
   cout << fun(1000);
   return 0;
}

A. 0
B. 1000
C. 10
D. Error

Q.3.
Which of the following permits function overloading on c++?

a) type
b) number of arguments
c) type & number of arguments
d) number of objects

Q.4.
Give the output of the following:

#include<iostream>
using namespace std;
void sample(int n1=10,int n2=20,int n2=30)
{
     return(n1+n2+n3);
}
int main()
{
	int z;
   	z=sample();
   	cout<<"z = "<<z<<endl;
   	return 0;
}

a) 10
b) 20
c) 60
d) Error

Q.5.
Function overloading is also similar to which of the following?

a) operator overloading
b) constructor overloading
c) destructor overloading
d) function overloading