Vidyalelo
C++ Programming · Q346

C++ miscellaneous

Programming · C++ Programming · question 346

Q346

What will be the output of the following C++ code? #include #include #include using namespace std; template class A T a; public: A() ~A() ; int main(int argc, char const *argv[]) A a1; A a2; A a3; cout<<sizeof(a1)<<endl; cout<<sizeof(a2)<<endl; cout<<sizeof(a3)<<endl; return 0;

A.
1
4
8
Answer
B.
4
1
8
C.
1
1
1
D.
4
4
4

Answer: Option A

Solution

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