InterviewSolution
Saved Bookmarks
| 1. |
Output of following program? Assume that the size of int is 4 bytes and size of double is 8 bytes, and there is no alignment done by the compiler.#include<iostream>#include<stdlib.h>using namespace std;template<class T, class U, class V=double>class A {T x;U y;V z;static int count;};int main(){A<int, int> a;A<double, double> b;cout << sizeof(a) << endl;cout << sizeof(b) << endl;return 0;}(A)1624(B)816(C)2028(D) Compiler Error: template parameters cannot have default values. |
| Answer» | |