Specialization

1

What is other name of full specialization?

A. explicit specialization
B. implicit specialization
C. function overloading template
D. None of the mentioned

2

How many types of specialization are there in c++?

A. 1
B. 2
C. 3
D. 4

3

What is the output of this program?

1.
    #include 
2.
    using namespace std;
3.
    template class A
4.
    {
5.
        public:
6.
        A();
7.
        int value;
8.
    };
9.
    template<> class A<> 
10.
    { 
11.
        public: A(); 
12.
    };
13.
    template<> class A
14.
    { 
15.
        public: A();
16.
    };
17.
    template A::A() : value(i)
18.
    {
19.
        cout << value;
20.
    }
21.
    A<>::A() 
22.
    {
23.
        cout << "default";
24.
    }
25.
    A::A() 
26.
    {
27.
        cout << "10" << endl;
28.
    }
29.
    int main() 
30.
    {
31.
        A x;
32.
        A<> y;
33.
        A z;
34.
    }
A. 6
B. 10
C. 6default10
D. None of the mentioned

4

What is the output of this program?

1.
    #include 
2.
    #include 
3.
    #include 
4.
    using namespace std;
5.
    template 
6.
    type MyMax(const type Var1, const type Var2)
7.
    {
8.
        cout << "no specialization";
9.
        return Var1 < Var2 ? Var2 : Var1;
10.
    }
11.
    template <>
12.
    const char *MyMax(const char *Var1, const char *Var2)
13.
    {
14.
        return (strcmp(Var1, Var2)<0) ? Var2 : Var1;
15.
    }
16.
    int main()
17.
    {
18.
        string Str1 = "class", Str2 = "template";
19.
        const char *Var3 = "class";
20.
        const char *Var4 = "template";
21.
        const char *q = MyMax(Var3, Var4);
22.
        cout << q << endl;
23.
        return 0;
24.
    }
A. template
B. class
C. no specialization
D. None of the mentioned

5

What is the output of this program?

1.
    #include 
2.
    using namespace std;
3.
    template 
4.
    class XYZ
5.
    {
6.
        public:
7.
        void putPri();
8.
        static T ipub;
9.
        private:
10.
        static T ipri; 
11.
    };
12.
    template 
13.
    void XYZ::putPri()
14.
    {
15.
        cout << ipri++ << endl;
16.
    }
17.
    template  T XYZ::ipub = 1;
18.
    template  T XYZ::ipri = 1.2;
19.
    int main()
20.
    {
21.
        XYZ a;
22.
        XYZ b;
23.
        a.putPri();
24.
        cout << a.ipub << endl;
25.
        b.putPri();
26.
    }

a) 1

b) 1.2

c) 1

1.2

d) 1

1

1.2