Functions

Q1: Which of the following statement is correct about the program given below?
#include<iostream.h> 
static double gDouble; 
static float  gFloat; 
static double gChar; 
static double gSum = 0; 
class BaseOne
{
    public:
    void Display(double x = 0.0, float y = 0.0, char z = 'A')
    {
        gDouble = x;
        gFloat  = y;
        gChar   = int(z);
        gSum    = gDouble + gFloat + gChar;
        cout << gSum; 
    }
};
class BaseTwo
{
    public: 
    void Display(int x = 1, float y = 0.0, char z = 'A')
    {
        gDouble = x;
        gFloat  = y;
        gChar   = int(z); 
        gSum    = gDouble + gFloat + gChar;
        cout << gSum;
    }
};
class Derived : public BaseOne, BaseTwo
{
    void Show()
    {
        cout << gSum;
    } 
}; 
int main()
{
    Derived objDev;
    objDev.BaseTwo::Display(10, 20, 'Z');
    return 0; 
}

A The program will print the output 120.

B The program will report compile-time error.

C The program will report run-time error.

D The program will print the output 0.

E The program will print the output garbage value.

ANS:D - The program will report compile-time error.

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.