Cpp Programming Quiz 263 – Which of the following gets called when an object goes out of scope?
[A].
constructor
[B].
destructor
[C].
main
[D].
virtual function
Answer: Option B
Explanation:
No answer description available for this question.
destructor
[C].
main
[D].
virtual function
Answer: Option B
Explanation:
No answer description available for this question.
Answer: Option A
Answer: Option C
#include
class IndiabixSample
{
    private:
    int AdditionOne(int x, int y = 1)
    {
        return x * y;
    }
    public:
    int AdditionTwo(int x, int y = 1)
    {
        return x / y;
    }
};
int main()
{
    IndiabixSample objBix;
    cout<
[A].The program will print the output 32 0.
[B].The program will print the output 32 garbage-value.
[C].The program will print the output 32 1.
[D].The program will report compile time error. 
Answer: Option D
Answer: Option D
#include
class Base
{
    int x, y;
    public:
    Base()
    {
        x = y = 0;
    }
    Base(int xx)
    {
        x = xx;
    }
    Base(int p, int q = 10)
    {
        x = p + q;
        y = q;
    }
    void Display(void)
    {
        cout<< x << " " << y << endl;
    } 
}objDefault(1, 1);
class Derived: public Base
{
    Base obj; 
    public:
    Derived(int xx, int yy): Base(xx, xx + 1)
    { }
    Derived(Base objB = objDefault)
    { } 
}; 
int main()
{
    Derived objD(5, 3);
    Derived *ptrD = new Derived(objD);
    ptrD->Display();
    delete ptrD;
    return 0;
}
[A].3 2
[B].8 3
[C].11 6
[D].11 10 
Answer: Option C