1. Which of the following permits function overloading on c++?
a) type
b) number of arguments
c) both of the mentioned
d) none of the mentioned
2. In which of the following we cannot overload the function?
a) return function
b) caller
c) called function
d) none of the mentioned
3. Function overloading is also similar to which of the following?
a) operator overloading
b) constructor overloading
c) destructor overloading
d) none of the mentioned
4. What is the output of this program?
a) 5500.263
b) 500.2635
c) 500.263
d) none of the mentioned
5. What is the output of this program?
a) 11 12.1
b) 12.1 11
c) 11 12
d) compile time error
6. What is the output of the following program?
a) 10.0 5.0
b) 5.0 2.5
c) 10.0 5
d) 10 2.5
7. Overloaded functions are
a) Very long functions that can hardly run
b) One function containing another one or more functions inside it.
c) Two or more functions with the same name but different number of parameters or type.
d) none of the mentioned
8. What will happen while using pass by reference
a) The values of those variables are passed to the function so that it can manipulate them
b) The location of variable in memory is passed to the function so that it can use the same memory area for its processing
c) The function declaration should contain ampersand (& in its type declaration)
d) All of the mentioned
9. When our function doesn’t need to return anything means what we will as parameter in function?
a) void
b) blank space
c) both a & b
d) none of the mentioned
10. What are the advantages of passing arguments by reference?
a) Changes to parameter values within the function also affect the original arguments.
b) There is need to copy parameter values (i.e. less memory used)
c) There is no need to call constructors for parameters (i.e. faster)
d) All of the mentioned
a) type
b) number of arguments
c) both of the mentioned
d) none of the mentioned
2. In which of the following we cannot overload the function?
a) return function
b) caller
c) called function
d) none of the mentioned
3. Function overloading is also similar to which of the following?
a) operator overloading
b) constructor overloading
c) destructor overloading
d) none of the mentioned
4. What is the output of this program?
#include <iostream>
using namespace std;
void print(int i)
{
cout << i;
}
void print(double f)
{
cout << f;
}
int main(void)
{
print(5);
print(500.263);
return 0;
}
b) 500.2635
c) 500.263
d) none of the mentioned
5. What is the output of this program?
#include <iostream>
using namespace std;
int Add(int X, int Y, int Z)
{
return X + Y;
}
double Add(double X, double Y, double Z)
{
return X + Y;
}
int main()
{
cout << Add(5, 6);
cout << Add(5.5, 6.6);
return 0;
}
b) 12.1 11
c) 11 12
d) compile time error
6. What is the output of the following program?
#include <iostream>
using namespace std;
int operate (int a, int b)
{
return (a * b);
}
float operate (float a, float b)
{
return (a / b);
}
int main()
{
int x = 5, y = 2;
float n = 5.0, m = 2.0;
cout << operate(x, y) <<"t";
cout << operate (n, m);
return 0;
}
b) 5.0 2.5
c) 10.0 5
d) 10 2.5
7. Overloaded functions are
a) Very long functions that can hardly run
b) One function containing another one or more functions inside it.
c) Two or more functions with the same name but different number of parameters or type.
d) none of the mentioned
8. What will happen while using pass by reference
a) The values of those variables are passed to the function so that it can manipulate them
b) The location of variable in memory is passed to the function so that it can use the same memory area for its processing
c) The function declaration should contain ampersand (& in its type declaration)
d) All of the mentioned
9. When our function doesn’t need to return anything means what we will as parameter in function?
a) void
b) blank space
c) both a & b
d) none of the mentioned
10. What are the advantages of passing arguments by reference?
a) Changes to parameter values within the function also affect the original arguments.
b) There is need to copy parameter values (i.e. less memory used)
c) There is no need to call constructors for parameters (i.e. faster)
d) All of the mentioned
I was very interested in the article
ReplyDelete