Cpp Programming Quiz 118 – What will be the output of the following program?

Question: What will be the output of the following program?

#include
class India
{
public:
struct Bix
{
int x;
float y;
void Function(void)
{
y = x = (x = 4*4);
y = --y * y;
}
void Display()
{
cout<< y << endl; } }B; }I; int main() { I.B.Display(); return 0; }

[A].0
[B].1
[C].-1
[D].Garbage value 

Answer: Option A

Cpp Programming Quiz 119 – Which of the following statements is correct about the program given below?

Question: Which of the following statements is correct about the program given below?

class Bix
{
public:
static void MyFunction();
};
int main()
{
void(*ptr)() = &Bix::MyFunction;
return 0;
}

[A].The program reports an error as pointer to member function cannot be defined outside the definition of class.
[B].The program reports an error as pointer to static member function cannot be defined.
[C].The program reports an error as pointer to member function cannot be defined without object.
[D].The program reports linker error. 

Answer: Option D

Cpp Programming Quiz 122 – Which of the following statements about virtual base classes is correct?

Question: Which of the following statements about virtual base classes is correct?
[A]. It is used to provide multiple inheritance.
[B]. It is used to avoid multiple copies of base class in derived class.[C]. It is used to allow multiple copies of base class in a derived class.
[D]. It allows private members of the base class to be inherited in the derived class.

Answer: Option B

Cpp Programming Quiz 124 – What happens when we try to compile the class definition in following code snippet?

Question: What happens when we try to compile the class definition in following code snippet?

class Birds {};
class Peacock : protected Birds {};

[A].[ez-toc] It will not compile because class body of Birds is not defined.
[B].It will not compile because class body of Peacock is not defined.
[C].It will not compile because a class cannot be protectedly inherited from other class.
[D].It will compile succesfully.

Answer: Option D

Cpp Programming Quiz 125 – Which of the following statement is correct regarding destructor of base class?

Question: Which of the following statement is correct regarding destructor of base class?
[A].Destructor of base class should always be static.
[B].Destructor of base class should always be virtual.[C].Destructor of base class should not be virtual.
[D].Destructor of base class should always be private.

Answer: Option B