CPP

CPP

Argument Passing has 6 Questions
How many ways of passing a parameter are there in c++?

1
2
3
4
Which is used to keep the call by reference value as intact ?

static
const
absolute
none of the mentioned
By default how the value are passed in c++?

call by value
call by reference
call by pointer
none of the mentioned
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     void copy (int& a, int& b, int& c)
  4.     {
  5.         a *= 2;
  6.         b *= 2;
  7.         c *= 2;
  8.     }
  9.     int main ()
  10.     {
  11.         int x = 1, y = 3, z = 7;
  12.         copy (x, y, z);
  13.         cout << "x =" << x << ", y =" << y << ", z =" << z;
  14.         return 0;
  15.     }

2 5 10
2 4 5
2 6 14
none of the mentioned
What is the new value of x?
  1.     #include 
  2.     using namespace std;
  3.     void fun(int &x)
  4.     {
  5.         x = 20;
  6.     }
  7.     int main()
  8.     {
  9.          int x = 10;
  10.          fun(x);
  11.          cout << "New value of x is " << x;
  12.          return 0;
  13.     }

10
20
15
none of the mentioned
What will happen when we use void in argument passing?

It will not return value to its caller
It will return value to its caller
both a & b are correct
none of the mentioned