Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

Cpp Programming Quiz 152 – What will be the output of the following program?

Question: What will be the output of the following program?

#include
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 

Answer: Option C