Cpp Programming Quiz 43 – Which of the following concepts means wrapping up of data and functions together?
[B]. Encapsulation[C]. Inheritance
[D]. Polymorphism
Answer: Option B
Answer: Option B
Answer: Option C
#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
[B].
[C].
[D].
Answer: Option B
Explanation:
No answer description available for this question.
6 6 5
[C].
5 40 38
[D].
6 40 38
Answer: Option D
Explanation:
No answer description available for this question.
[A].Only 1 is correct.
[B].Only 2 is correct.[C].Both 1 and 2 are correct.
[D].Both 1 and 2 are incorrect.
Answer: Option B
#include
class BaseCounter
{
protected:
long int count;
public:
void CountIt(int x, int y = 10, int z = 20)
{
count = 0;
cout<< x << " " << y << " " << z << endl;
}
BaseCounter()
{
count = 0;
}
BaseCounter(int x)
{
count = x ;
}
};
class DerivedCounter: public BaseCounter
{
public:
DerivedCounter()
{ }
DerivedCounter(int x): BaseCounter(x)
{ }
};
int main()
{
DerivedCounter objDC(30);
objDC.CountIt(40, 50);
return 0;
}
[A].30 10 20
[B].Garbage 10 20
[C].40 50 20
[D].20 40 50
Answer: Option C