A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

91. Which among the following is the proper syntax for the template class?
a. template ;
b. Template ;
c. template T named(T x, T y){ }
d. Template T1 named(T1 x, T2 y){ }
View Answer Report Discuss Too Difficult!
Answer: (c).template T named(T x, T y){ }

92. Can default arguments be used with the template class?
a. Yes, in some special cases
b. Yes, always
c. No, it must satisfy some specific conditions first
d. No, it can’t be done
View Answer Report Discuss Too Difficult!
Answer: (b).Yes, always

93. What is the syntax to use explicit class specialization?
a. template class myClass<>{ }
b. template class myClass{ }
c. template <> class myClass<>{ }
d. template <> class myClass{ }
View Answer Report Discuss Too Difficult!
Answer: (d).template <> class myClass{ }

94. Which is the most significant feature that arises by using template classes?
a. Code readability
b. Ease in coding
c. Code reusability
d. Modularity in code
View Answer Report Discuss Too Difficult!
Answer: (c).Code reusability

95. A template class defines the form of a class _____________________ it will operate.
a. With full specification of the data on which
b. With full specification of the functions on which
c. Without full specification of the data on which
d. Without full specification of the functions on which
View Answer Report Discuss Too Difficult!
Answer: (c).Without full specification of the data on which

96. What are the two specializations of I/O template classes in C++?
a. 16-bit character and wide characters
b. 8-bit character and wide characters
c. 32-bit character and locale characters
d. 64-bit characters and locale characters
View Answer Report Discuss Too Difficult!
Answer: (b).8-bit character and wide characters

97. Can typeid() function be used with the object of generic classes?
a. Yes, only if default type is given
b. Yes, always
c. No, generic data can’t be determined
d. No, never possible
View Answer Report Discuss Too Difficult!
Answer: (b).Yes, always

98. The _____________ class is a specialization of a more general template class.
a. String
b. Integer
c. Digit
d. Math
View Answer Report Discuss Too Difficult!
Answer: (a).String

99. How is function overloading different from template class?
a. Overloading is multiple function doing same operation, Template is multiple function doing different operations
b. Overloading is single function doing different operations, Template is multiple function doing different operations
c. Overloading is multiple function doing similar operation, Template is multiple function doing identical operations
d. Overloading is multiple function doing same operation, Template is same function doing different operations
View Answer Report Discuss Too Difficult!
Answer: (c).Overloading is multiple function doing similar operation, Template is multiple function doing identical operations

100. What if static members are declared inside template classes?
a. All instances will share the static variable
b. All instances will have their own static variable
c. All the instances will ignore the static variable
d. Program gives compile time error
View Answer Report Discuss Too Difficult!
Answer: (b).All instances will have their own static variable