Home » C++ Programming » Introduction » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    void function(int p, bool condition = true)
    {
    if (condition == true )
    {
    cout << "Condition is true. P = " << p;
    }
    else
    {
    cout << "Condition is false. P = " << p;
    }
    }
    int main()
    {
    function(250, false);
    return 0;
    }
    1. Condition is true. P = 250
    2. 200
    3. Condition is false. P = 250
    4. True
    5. False
Correct Option: C

In this program, we are passing the value, as it evaluates to false, it produces the output as following.



Your comments will be displayed only after manual approval.