Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

Cpp Programming Quiz 117 – Which of the following statement is correct about the program given below?

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

#include
#include class IndiaBix
{
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