Cpp Programming Quiz 53 – Which of the following statements is correct?
[B]. Derived class pointer cannot point to base class.[C]. Pointer to derived class cannot be created.
[D]. Pointer to base class cannot be created.
Answer: Option B
Answer: Option B
class Bike
{
Engine objEng;
};
class Engine
{
float CC;
};
[A].kind of relationship
[B].has a relationship
[C].Inheritance
[D].Both A and B
Answer: Option B
#include
int main()
{
int x = 0;
int &y = x; y = 5;
while(x <= 5)
{
cout<< y++ << " ";
x++;
}
cout<< x;
return 0;
}[A].The program will print the output 5 6 7 8 9 10.
[B].The program will print the output 5 6 7 8 9 10 7.
[C].The program will print the output 5 7.
[D].It will result in a compile time error.
Answer: Option C
Answer: Option D
destructor
[C].
function
[D].
object
Answer: Option B
Explanation:
No answer description available for this question.
Answer: Option D
#include
#include
{
static int x;
public:
IndiaBix()
{
if(x == 1)
exit(0);
else
x++;
}
void Display()
{
cout<< x << " ";
}
};
int IndiaBix::x = 0;
int main()
{
IndiaBix objBix1;
objBix1.Display();
IndiaBix objBix2;
objBix2.Display();
return 0;
}
[A].The program will print the output 1 2.
[B].The program will print the output 0 1.
[C].The program will print the output 1 1.
[D].The program will print the output 1.
Answer: Option D