Cpp Programming Quiz 120 – What does a class hierarchy depict?
[B].It describes “has a” relationships.[C].It describes “kind of” relationships.
[D].It shows the same relationship as a family tree.
Answer: Option C
Answer: Option C
#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
#include
class Bix
{
int x, y;
public:
Bix(int x, int y)
{
this->x = x;
this->y = y;
}
void Display()
{
cout<< x << " " << y;
}
};
int main()
{
int x = 50;
int &y = x ;
Bix b(y, x);
return 0;
}
[A].The program will print the output 50 50.
[B].The program will print the two garbage values.
[C].It will result in a compile time error.
[D].The program will print nothing.
Answer: Option D
are inherited
[C].
are not called
[D].
are created
Answer: Option C
Explanation:
No answer description available for this question.
#include
class PowerFinder
{
public:
void Power(int x = 1, int y = 1)
{
int P = 1, i = 1;
while(++i <= y)
{
P *= x;
}
cout<< P << endl;
}
};
int main()
{
PowerFinder FP;
FP.Power(2, 6);
return 0;
}
[A].The program will print the output 12.
[B].The program will print the output 16.
[C].The program will print the output 32.
[D].The program will print the output 36.
Answer: Option C
Answer: Option C
Destructor destroys only float data members of the object.
[C].
Destructor destroys only pointer data members of the object.
[D].
Destructor destroys the complete object.
Answer: Option D
Explanation:
No answer description available for this question.