Vidyalelo
C++ Programming · Q239

C++ miscellaneous

Programming · C++ Programming · question 239

Q239

What will be the output of the following C++ code? #include using namespace std; template void fun(const T&x) static int count = 0; cout (1); cout (1); cout (1.1); cout << endl; return 0;

A.
x = 1 count = 0
x = 1 count = 1
x = 1.1 count = 0
Answer
B.
x = 1 count = 0
x = 1.0 count = 1.0
x = 1.1 count = 0
C.
x = 1.0 count = 0.0
x = 1 count = 1
x = 1.1 count = 0
D.
x = 1.0 count = 0.0
x = 1.0 count = 1.0
x = 1.1 count = 0.0

Answer: Option A

Solution

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