Objects and Classes

Q1:
What will be the output of the following program?
#include<iostream.h> 
class AptitudeBase
{
    public:
        float x; 
}; 
class AptitudeDerived : public AptitudeBase
{
    public: 
        char ch; 
        void Process()
        {
            ch = (int)((x=12.0)/3.0);
        }
        void Display()
        {
            cout<< (int)ch;
        } 
}; 
int main()
{
    class AptitudeDerived  *objDev = new AptitudeDerived;
    objDev->Process();
    objDev->Display();
    return 0; 
}

A The program will print the output 4.

B The program will print the ASCII value of 4.

C The program will print the output 0.

D The program will print the output garbage.

ANS:A - The program will print the output 4.

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.