CPP

CPP

Overloaded Function Names has 10 Questions
Which of the following permits function overloading on c++?

type
number of arguments
both of the mentioned
none of the mentioned
In which of the following we cannot overload the function?

return function
caller
called function
none of the mentioned
Function overloading is also similar to which of the following?

operator overloading
constructor overloading
destructor overloading
none of the mentioned
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     void print(int i)
  4.     {
  5.         cout << i;
  6.     }
  7.     void print(double  f)
  8.     {
  9.         cout << f;
  10.     }
  11.     int main(void)
  12.     {
  13.         print(5);
  14.         print(500.263);
  15.         return 0;
  16.     }

5500.263
500.2635
500.263
none of the mentioned
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     int Add(int X, int Y, int Z)
  4.     {
  5.         return X + Y;
  6.     }
  7.     double Add(double X, double Y, double Z)
  8.     {
  9.         return X + Y;
  10.     }
  11.     int main()
  12.     {
  13.         cout << Add(5, 6);
  14.         cout << Add(5.5, 6.6);
  15.         return 0;
  16.     }

11 12.1
12.1 11
11 12
compile time error
What is the output of the following program?
  1.     #include 
  2.     using namespace std;
  3.     int operate (int a, int b)
  4.     {
  5.         return (a * b);
  6.     }
  7.     float operate (float a, float b)
  8.     {
  9.         return (a / b);
  10.     }
  11.     int main()
  12.     {
  13.         int x = 5, y = 2;
  14.         float n = 5.0, m = 2.0;
  15.         cout << operate(x, y) <<"\t";
  16.         cout << operate (n, m);
  17.         return 0;
  18.     }

10.0 5.0
5.0 2.5
10.0 5
10 2.5
Overloaded functions are

Very long functions that can hardly run
One function containing another one or more functions inside it.
Two or more functions with the same name but different number of parameters or type.
none of the mentioned
What will happen while using pass by reference?

The values of those variables are passed to the function so that it can manipulate them
The location of variable in memory is passed to the function so that it can use the same memory area for its processing
The function declaration should contain ampersand (& in its type declaration)
All of the mentioned
When our function doesn't need to return anything means what will we use/send as parameter in function ?

void
blank space
both a & b
none of the mentioned
What are the advantages of passing arguments by reference?

Changes to parameter values within the function also affect the original arguments.
There is need to copy parameter values (i.e. less memory used)
There is no need to call constructors for parameters (i.e. faster)
All of the mentioned