Questions and Answers


  1. What is the output of this program?
    #include 
    using namespace std;
    int Fun(int p, int q)
    {
    int res;
    res = 0;
    while (q != 0)
    {
    res = res + p;
    q = q - 2;
    }
    return(res);
    }
    int main ()
    {
    int p = 12, q = 10;
    cout << Fun(p, q) ;
    return(0);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    We are multiplying these values by adding every values.


  1. What is the output of this program?
    #include 
    using namespace std;
    double Time()
    {
    double T = 26.25;
    double H = T;
    return H;
    }
    int main()
    {
    double H = Time();
    cout << "Weekly Hours: " << H;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    We are returning the value what we get as input.



  1. What is the output of this program?
    #include 
    using namespace std;
    int max(int p, int q)
    {
    return ( p > q ? p : q);
    }
    int main()
    {
    int m = 15;
    int n = 16;
    cout << max(m, n);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    In this program, we are returning the maximum value by using conditional operator.


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    caller function



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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Void is used to not to return anything.