26. 

What will be the output of the following program?

#include<iostream.h> 
class IndiaBix
{
    public: 
    int x, y;
    IndiaBix(int xx = 10, int yy = 20)
    {
        x = xx;
        y = yy; 
    }
    void Exchange(int *, int *);
};
int main()
{
    IndiaBix objA(30, 40); 
    IndiaBix objB(50); 
    objA.Exchange(&objA.x, &objB.y); 
    cout<< objA.x << " " << objB.y << endl; 
    return 0;
}
void IndiaBix::Exchange(int *x, int *y)
{
    int t;
    t  = *x;
    *x = *y;
    *y = t ; 
}

A. 20 10
B. 30 20
C. 20 30
D. 30 40
E. 50 30

27. 

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

#include<iostream.h> 
class BixArray
{
    int Matrix[3][3]; 
    public:
    BixArray()
    {
        for(int i = 0; i<3; i++)
           for(int j = 0; j < 3; j++) 
              Matrix[j][i] = i + j; 
    }
    void Display(void)
    {
        for(int i = 0; i < 3; i++)
           for(int j = 0; j < 3; j++) 
              cout<< Matrix[j][i] << " "; 
    } 
}; 
int main()
{
    BixArray objBix;
    objBix.Display();
    return 0; 
}

A. The program will display the output 4 3 2 3 2 1 2 1 0.
B. The program will display the output 0 1 2 1 2 3 2 3 4.
C. The program will display the output 9 garbage values.
D. The program will report error on compilation.

28. 

What will be the output of the following program?

#include<iostream.h> 
class IndiaBix
{
    int x, y, z; 
    public:
    void Apply(int xx = 12, int yy = 21, int zz = 9)
    {
        x = xx;
        y = yy += 10;
        z = x -= 2;
    }
    void Display(void)
    {
        cout<< x << " " << y << endl; 
    } 
    void SetValue(int xx, int yy)
    {
        Apply(xx, 0, yy);
    }
};
int main()
{
    IndiaBix *pBix= new IndiaBix;
   (*pBix).SetValue(12, 20);
    pBix->Display();
    delete pBix;
    return 0; 
}

A. 10 10
B. 12 10
C. 12 21
D. 12 31
E. The program will report compilation error.

29. 

What will be the output of the following program?

#include<iostream.h>
#include<string.h> 
class IndiaBix
{
    char txtMsg[50]; 
    public:
    IndiaBix(char *str = NULL)
    {
    if(str != NULL)
       strcpy(txtMsg, str);
    }
    int BixFunction(char ch);
};
int IndiaBix::BixFunction(char ch)
{
    static int i = 0;
    if(txtMsg[i++] == ch)
        return strlen((txtMsg + i)) - i;
    else
        return BixFunction(ch);
}
int main()
{
    IndiaBix objBix("Welcome to IndiaBix.com!");
    cout<< objBix.BixFunction('t');
    return 0;
}

A. 6
B. 8
C. 9
D. 15
E. 16

30. 

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

#include<iostream.h>
#include<string.h>
#include<malloc.h>
class BixString
{
    char txtName[20]; 
    public:
    BixString(char *txtTemp = NULL)
    {
        if(txtTemp != NULL)
        strcpy(txtName, txtTemp);
    }
    void Display(void)
    {
        cout<<txtName;
    }
};
int main()
{
    char *txtName = (char*)malloc(10);
    strcpy(txtName, "IndiaBIX");
    *txtName = 48;
    BixString objTemp(txtName);
    cout<< sizeof(txtName);
    return 0; 
}

A. Above program will display IndiaBIX 8.
B. Above program will display IndiaBIX 9.
C. Above program will display size of integer.
D. Above program will display IndiaBIX and size of integer.
E. Above program will display 1.