Q.1

What will be the output of the following program?

#include<iostream.h> 
class Bix
{
    public:
      int x;
};
int main()
{
    Bix *p = new Bix();

    (*p).x =    cout<< (*p).x << " " << p->x << " " ;

    p->x =    cout<< (*p).x << " " << p->x ;

    return}
  • 10 10 20 20
  • Garbage garbage 20 20
  • 10 10 Garbage garbage
  • Garbage garbage Garbage garbage
Q.2

What will be the output of the following program?

#include<iostream.h> 
class A
{
    public:
    void BixFunction(void)
    {
        cout<< "Class A" << endl;
    }
};
class B: public A
{
    public:
    void BixFunction(void)
    {
        cout<< "Class B" << endl;
    } 
};
class C : public B
{
    public:
    void BixFunction(void)
    {
        cout<< "Class C" << endl;
    } 
};
int main()
{
    A *ptr;
    B objB;
    ptr = &objB;
    ptr = new C();
    ptr->BixFunction();
    return
}
  • Class A.
  • Class B.
  • Class C.
  • The program will report compile time error.
Q.3

What will be the output of the following program?

#include<iostream.h> 
class IndiaBix
{
    static int count; 
    public:
    static void First(void)
    {
        count =    }
    static void Second(int x)
    {
        count = count + x; 
    }
    static void Display(void)
    {
        cout<< count << endl;
    } 
};
int IndiaBix::count =
int main()
{
    IndiaBix :: First();
    IndiaBix :: Second(5);
    IndiaBix :: Display();
    return
}
  • 0  
  • 5
  • 10
  • 15
  • The program will report compile time error.
Q.4

What will be the output of the following program?

#include<iostream.h> 
class India
{
    public:
    struct Bix
    {
        int   x;
        float y;
        void Function(void)
        {
            y = x = (x = 4*4); 
            y = --y * y;
        }
        void Display()
        {
            cout<< y << endl;
        } 
    }B; 
}I; 
int main()
{
    I.B.Display(); 
    return}
  • 0
  • 1
  • -1
  • Garbage value
Q.5

How many objects can be created from an abstract class?

  • Zero
  • One
  • Two
  • As many as we want
Q.6

Which of the following can be overloaded?

  • Object
  • Functions
  • Operators
  • Both B and C
Q.7

Which of the following statements is correct when a class is inherited publicly?

  • Public members of the base class become protected members of derived class.
  • Public members of the base class become private members of derived class.
  • Private members of the base class become protected members of derived class.
  • Public members of the base class become public members of derived class.
Q.8

Which of the following statement is correct about the program given below?

#include<iostream.h> 
class IndiaBix
{
    static int x; 
    public:
    static void SetData(int xx)
    {
        x = xx; 
    }
    void Display() 
    {
        cout<< x ;
    }
};
int IndiaBix::x =
int main()
{
    IndiaBix::SetData(33);
    IndiaBix::Display();
    return
}
  • The program will print the output 0.
  • The program will print the output 33.
  • The program will print the output Garbage.
  • The program will report compile time error.
Q.9

Which of the following statement is correct about the program given below?

#include<iostream.h> 
class BixBase
{
    int x, y; 
    public:
    BixBase(int xx =int yy =    {
        x = xx;
        y = yy;
    }
    void Show()
    {
        cout<< x * y << endl;
    }
};
class BixDerived : public BixBase
{
    private:
        BixBase objBase; 
    public:
    BixDerived(int xx, int yy) : BixBase(xx, yy), objBase(yy, yy)
    {
        objBase.Show();
    }
};
int main()
{
    BixDerived objDev(20);
    return
}
  • The program will print the output 100.
  • The program will print the output 200.
  • The program will print the output 400.
  • The program will print the output Garbage-value.
  • The program will report compile time error.
Q.10

What will be the output of the following program?

#include<iostream.h> 
class BixBase
{
    public:
        float x; 
}; 
class BixDerived : public BixBase
{
    public: 
        char ch; 
        void Process()
        {
            ch = (int)((x=12.0)/3.0);
        }
        void Display()
        {
            cout<< (int)ch;
        } 
}; 
int main()
{
    class BixDerived  *objDev = new BixDerived;
    objDev->Process();
    objDev->Display();
    return
}
  • The program will print the output 4.
  • The program will print the ASCII value of 4.
  • The program will print the output 0.
  • The program will print the output garbage.
Q.11

What will be the output of the following program?

#include<iostream.h>
#include<string.h> 
class IndiaBix
{
    int val; 
    public:
    void SetValue(char *strchar *str    {
        val = strcspn(strstr2);
    }
    void ShowValue()
    {
        cout<< val;
    } 
};
int main() 
{
    IndiaBix objBix;
    objBix.SetValue((char*)"India", (char*)"Bix"); 
    objBix.ShowValue(); 
    return
}
  • 2
  • 3
  • 5
  • 8
Q.12

What does the class definitions in following code represent?

class Bike
{
    Engine objEng;
};
class Engine
{
    float CC;
};
  • kind of relationship
  • has a relationship
  • Inheritance
  • Both A and B
Q.13

Which of the following means "The use of an object of one class in definition of another class"?

  • Encapsulation
  • Inheritance
  • Composition
  • Abstraction
Q.14

Which of the following statements is correct about the constructors and destructors?

  • Destructors can take arguments but constructors cannot.
  • Constructors can take arguments but destructors cannot.
  • Destructors can be overloaded but constructors cannot be overloaded.
  • Constructors and destructors can both return a value.
Q.15

Which of the following statement is correct about the program given below?

#include<iostream.h> 
class IndiaBix
{
    static int x; 
    public:
    static void SetData(int xx)
    {
        x = xx; 
    }
    static void Display() 
    {
        cout<< x ;
    }
};
int IndiaBix::x =
int main()
{
    IndiaBix::SetData(44);
    IndiaBix::Display();
    return
}
  • The program will print the output 0.
  • The program will print the output 44.
  • The program will print the output Garbage.
  • The program will report compile time error.
Q.16

What will be the output of the following program?

#include<iostream.h> 
class BixTeam
{
    int x, y; 
    public:
    BixTeam(int xx)
    {
        x = ++xx;
    }
    void Display()
    {
        cout<< --x << " ";
    }
};
int main()
{
    BixTeam objBT(45);
    objBT.Display();
    int *p = (int*)&objBT;
    *p =    objBT.Display();
    return
}
  • 45 22
  • 46 22
  • 45 23
  • 46 23
Q.17

What happens when we try to compile the class definition in following code snippet?

class Birds {};
class Peacock : protected Birds {};
  • It will not compile because class body of Birds is not defined.
  • It will not compile because class body of Peacock is not defined.
  • It will not compile because a class cannot be protectedly inherited from other class.
  • It will compile succesfully.
Q.18

What will be the output of the following program?

#include<iostream.h> 
class Point
{
    int x, y; 
    public:
    Point(int xx =int yy =    {
        x = xx;
        y = yy; 
    }
    Point operator + (Point objPoint)
    {
        Point objTmp;
        objTmp.x = objPoint.x + this->x; 
        objTmp.y = objPoint.y + this->y;
        return objTmp;
    }
    void Display(void)
    {
        cout<< x << " " << y;
    }
};
int main()
{
    Point objP    Point objP2(2);
    Point objP3 = objP1 + objP    objP3.Display(); 
    return
}
  • 1 2
  • 10 20
  • 11 22
  • Garbage Garbage
  • The program will report compile time error.
Q.19

Which of the following statement is correct about the program given below?

#include<iostream.h>
#include<process.h> 
class IndiaBix
{
    static int x; 
    public:
    IndiaBix()
    {
        if(x ==            exit(0); 
        else
            x++;
    }
    void Display()
    {
        cout<< x << " ";
    }
};
int IndiaBix::x =
int main()
{
    IndiaBix objBix
    objBix1.Display(); 
    IndiaBix objBix
    objBix2.Display(); 
    return
}
  • The program will print the output 1 2.
  • The program will print the output 0 1.
  • The program will print the output 1 1.
  • The program will print the output 1.
  • The program will report compile time error.
Q.20

Which of the following statement is correct about the program given below?

#include<iostream.h>
#include<string.h> 
class IndiaBix
{
    public:
    void GetData(char *s, int x, int y )
    {
        int i =        for (i = x-y>i++)
        {
            cout<< s[i];
            y--; 
        } 
    }
}; 
int main()
{
    IndiaBix objBix;
    objBix.GetData((char*)"Welcome!",3);
    return
}
  • The program will print the output me!.
  • The program will print the output Wel.
  • The program will print the output !em.
  • The program will print the output Welcome!.
  • The program will result in a compile time error.
0 h : 0 m : 1 s