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
#include
int main()
{
int m = 2, n = 6;
int &x = m++;
int &y = n++;
m = x++;
x = m++;
n = y++;
y = n++;
cout<< m << " " << n;
return 0;
}
[A].The program will print output 3 7.
[B].The program will print output 4 8.
[C].The program will print output 5 9.
[D].The program will print output 6 10.
Answer: Option E
#include
int main()
{
float Amount;
float Calculate(float P = 5.0, int N = 2, float R = 2.0);
Amount = Calculate();
cout<< Amount << endl;
return 0;
}
float Calculate(float P, int N, float R)
{
int Year = 1;
float Sum = 1 ;
Sum = Sum * (1 + P * ++N * R);
Year = (int)(Year + Sum);
return Year;
}
[A].21
[B].22
[C].31
[D].32
Answer: Option D
Answer: Option D
Answer: Option D
#include
static int Result;
class India
{
public:
void Change(int x = 10, int y = 20, int z = 30)
{
cout<< x + y + z;
}
void Display(int x = 40, float y = 50.00)
{
Result = x % x;
cout<< Result;
}
};
class Bix
{
int x, y;
public:
void Change(int x, int y = 50)
{
cout<< x + y;
}
};
class IndiaBix: public India, public Bix
{
public:
void Display(int x = 10, int xx = 100, int xxx = 1000)
{
Result = x + xx % x * x;
cout<< Result ;
}
};
int main()
{
IndiaBix objBix;
objBix.India::Display(10, 20.00);
return 0;
}
[A].The program will print the output 0.
[B].The program will print the output 10.
[C].The program will print the output 30.
[D].The program will print the output 40.
Answer: Option A
Answer: Option C