Home » C++ Programming » Introduction » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    int add(int p, int q);
    int main()
    {
    int n = 15, m = 16;
    cout << add(n, m) << endl;
    return 0;
    }
    int add(int p, int q )
    {
    int sum = p + q;
    p = 20;
    return p + q;
    }
    1. 36
    2. 15
    3. 16
    4. 20
    5. None of these
Correct Option: D

The value of p has been changed to 20, So it returns as 36.



Your comments will be displayed only after manual approval.