Cpp Programming Quiz 230 – A constructor that accepts __________ parameters is called the default constructor.
[A].
one
[B].
two
[C].
no
[D].
three
Answer: Option C
Explanation:
No answer description available for this question.
two
[C].
no
[D].
three
Answer: Option C
Explanation:
No answer description available for this question.
[B].
[C].
[D].
Answer: Option A
Explanation:
No answer description available for this question.
#include
class TestDrive
{
int x;
public:
TestDrive(int xx)
{
x = xx;
}
int DriveIt(void);
};
int TestDrive::DriveIt(void)
{
static int value = 0;
int m;
m = x % 2;
x = x / 2;
if((x / 2)) DriveIt();
value = value + m * 10;
return value;
}
int main()
{
TestDrive TD(1234);
cout<< TD.DriveIt() * 10 << endl;
return 0;
}
[A].300
[B].200
[C].Garbage value
[D].400
Answer: Option D
Friend function
[C].
Default constructor
[D].
const function
Answer: Option C
Explanation:
No answer description available for this question.
[B].
[C].
[D].
Answer: Option D
Explanation:
No answer description available for this question.
#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