Functions

Q1: Which of the following statement is correct about the program given below?
#include<iostream.h> 
class PowerFinder
{
    public:
    void Power(int x = 1, int y = 1)
    {
        int P = 1, i = 1;
        while(++i <= y)
        {
            P *= x;
        }
        cout<< P << endl; 
    } 
};
int main()
{
    PowerFinder FP; 
    FP.Power(2, 6); 
    return 0;
}

A The program will print the output 12.

B The program will print the output 16.

C The program will print the output 32.

D The program will print the output 36.

E The program will execute infinite time.

ANS:C - The program will print the output 32.

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.