MCQ - Templates in C++ Programming
21. How many bits of memory needed for internal representation of class?
A. 1
B. 2
C. 4
D. No memory needed
View Answer
Ans : D
Explanation: classes that contain only type members, nonvirtual function members, and static data members do not require memory at run time.
22. Which value is placed in the base class?
A. Derived values
B. Default type values
C. Both A & B
D. None of the above
View Answer
Ans : B
Explanation: We can place the default type values in a base class and overriding some of them through derivation.
23. What is other name of full specialization?
A. Explicit specialization
B. Implicit specialization
C. Function overloading template
D. None of the above
View Answer
Ans : A
Explanation: None
24. A common activity performed on a container is called
A. Functioning
B. Iterator
C. Traversal
D. All of them
View Answer
Ans : C
Explanation: None
25. How many types of templates are there in c++?
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : B
Explanation: There are two types of templates. They are function template and class template.
26. Which is dependant on template parameter?
A. Base class
B. Abstract class
C. Method
D. None of the above
View Answer
Ans : A
Explanation: None
27. Pick out the correct statement about string template?
A. It is used to replace a string.
B. It is used to replace a string with another string at runtime.
C. It is used to delete a string.
D. None of the above
View Answer
Ans : B
Explanation: Every string template is used to replace the string with another string at runtime
28. Containers have the same types, that's why they are called
A. Heterogeneous
B. Homogeneous
C. Vectors
D. None of them
View Answer
Ans : B
Explanation: None
Also check :
Discussion