adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    int add(int a, int b);
    int main()
    {
        int i = 5, j = 6;
        cout << add(i, j) << endl;
        return 0;
    }
    int add(int a, int b )
    {
        int sum = a + b;
        a = 7;
        return a + b;
    }

a.

11

b.

12

c.

13

d.

compile time error

Answer: (c).13

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. What will happen when we use void in argument passing?

Q. Where does the execution of the program starts?

Q. What are mandatory parts in function declaration?

Q. which of the following is used to terminate the function declaration?

Q. How many max number of arguments can present in function in c99 compiler?

Q. Which is more effective while calling the functions?

Q. What is the scope of the variable declared in the user definied function?

Q. How many minimum number of functions are need to be presented in c++?

Q. How many ways of passing a parameter are there in c++?

Q. Which is used to keep the call by reference value as intact?

Q. By default how the value are passed in c++?

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