Vidyalelo
C++ Programming · Q77

Introduction to C++

Programming · C++ Programming · question 77

Q77

What will be the output of the following C++ code? #include using namespace std; class Test static int x; public: Test() x++; static int getX() return x; ; int Test::x = 0; int main() cout << Test::getX() << " "; Test t[5]; cout << Test::getX();

A.
0 0
B.
5 0
C.
0 5
Answer
D.
5 5

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board