Cpp Programming Quiz 126 – Which of the following type of data member can be shared by all instances of its class?
[B]. Inherited[C]. Static
[D]. Friend
Answer: Option C
Answer: Option C
Destructor has the same name as that of the class with a tilde symbol at the beginning.
[C].
Both A and B.
[D].
Destructor has the same name as the first member function of the class.
Answer: Option C
Explanation:
No answer description available for this question.
Answer: Option B
#include
void MyFunction(int a, int b = 40)
{
cout<< " a = "<< a << " b = " << b << endl;
}
int main()
{
MyFunction(20, 30);
return 0;
}
[A].a = 20 b = 40
[B].a = 20 b = 30
[C].a = 20 b = Garbage
[D].a = Garbage b = 40
Answer: Option B
#include
const double BixConstant(const int, const int = 0);
int main()
{
const int c = 2 ;
cout<< BixConstant(c, 10)<< " ";
cout<< BixConstant(c, 20)<< endl;
return 0;
}
const double BixConstant(const int x, const int y)
{
return( (y + (y * x) * x % y) * 0.2);
}
[A].The program will print the output 2 4.
[B].The program will print the output 20 40.
[C].The program will print the output 10 20.
[D].The program will print the output 20 4.50.
Answer: Option A
[D]. Both A and B
Answer: Option C
Answer: Option C