Test Series - cpp

Test Number 48/102

Q: What is meant by template specialization?
A. It will have certain data types to be fixed
B. It will make certain data types to be dynamic
C. Certain data types are invalid
D. It will make all data types to be dynamic
Solution: In the template specialization, it will make the template to be specific for some data types.
Q: Which is similar to template specialization?
A. template
B. function overloading
C. function template overloading
D. overloading
Solution: function template overloading is similar to template specialization.
Q: Which is called on allocating the memory for the array of objects?
A. destructor
B. constructor
C. method
D. class
Solution: When you allocate memory for an array of objects, the default constructor must be called to construct each object. If no default constructor exists, you’re stuck needing a list of pointers to objects.
Q: How many types of specialization are there in c++?
A. 1
B. 2
C. 3
D. 4
Solution: There are two types of specialization. They are full specialization and partial specialization.
Q: What is another name of full specialization?
A. explicit specialization
B. implicit specialization
C. function overloading template
D. overloading template
Solution: explicit specialization is another name of full specialization.
Q: Which is dependant on template parameter?
A. base class
B. abstract class
C. method
D. static class
Solution: Base class is dependant on template parameter.
Q: Which value is placed in the base class?
A. derived values
B. default type values
C. both default type & derived values
D. null value
Solution: We can place the default type values in a base class and overriding some of them through derivation.
Q: How many bits of memory needed for internal representation of class?
A. 1
B. 2
C. 4
D. no memory needed
Solution: classes that contain only type members, nonvirtual function members, and static data members do not require memory at run time.
Q: How many kinds of entities are directly parameterized in c++?
A. 1
B. 2
C. 3
D. 4
Solution: C++ allows us to parameterize directly three kinds of entities through templates: types, constants, and templates.
Q: How many kinds of parameters are there in C++?
A. 1
B. 2
C. 3
D. 5
Solution: There are three kinds of parameters are there in C++. They are type, non-type, template.

You Have Score    /10