adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    void Sum(int a, int b, int & c)
    {
        a = b + c;
        b = a + c;
        c = a + b;
    }
    int main()
    {
        int x = 2, y =3;
        Sum(x, y, y);
        cout << x << " " << y;
        return 0; 
    }

a.

2 3

b.

6 9

c.

2 15

d.

compile time error

Answer: (c).2 15

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?

Similar Questions

Discover Related MCQs

Q. How many types of returning values are present in c++?

Q. What will you use if you are not intended to get a return value?

Q. Where does the return statement returns the execution of the program?

Q. When will we use the function overloading?

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

Q. In which of the following we cannot overload the function?

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

Q. Overloaded functions are

Q. What will happen while using pass by reference

Q. When our function doesn’t need to return anything means what will we use/send as parameter in function?

Q. What are the advantages of passing arguments by reference?

Q. If the user didn’t supply the value, what value will it take?

Q. Where can the default parameter be placed by the user?

Q. Which value will it take when both user and default values are given?

Q. What we can’t place followed by the non-default arguments?

Q. If we start our function call with default arguments means, what will be proceeding arguments?

Q. What is the default return type of a function ?

Q. Which header file is used to pass unknown number of arguments to function?

Q. How can you access the arguments that are manipulated in the function?

Q. What is the maximum number of arguments or parameters that can be