Home » C++ Programming » Comments » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    int add(int p, int q);
    int main()
    {
    int k = 7, L = 9;
    cout << add(k, L) << endl;
    return 0;
    }
    int add(int p, int q )
    {
    int sum = p + q;
    p = 10;
    return p + q;
    }
    1. 7
    2. 9
    3. 10
    4. 19
    5. None of these
Correct Option: D

The value of a has been changed to 10, So it returns as 19.



Your comments will be displayed only after manual approval.