A) Only in the definitions of the member functions defined outside the class.
B) Both in the prototype and definition of a member function.
C) Only if multiple class-template specializations will be created from this class template.
D) In neither the definition nor prototype of member functions.
Correct Answer
verified
Multiple Choice
A) Classes and objects.
B) Classes and functions.
C) Functions and return types.
D) Headers and source files.
Correct Answer
verified
Multiple Choice
A) A class-template specialization.
B) A member function of another class.
C) Another class template.
D) A global function.
Correct Answer
verified
Multiple Choice
A) With a non-template class, one copy of a static data member is shared among all objects created from that class.
B) Each class-template specialization created from a class template has its own copy of each static data member.
C) static data members of both template and non-template classes are initialized at file scope.
D) One copy of each static member function is shared between all class-template specializations in the class template.
Correct Answer
verified
Multiple Choice
A) May include the statement template< typename Type > anywhere.
B) Must put template< typename Type > before the class definition.
C) Must include template< typename Type > inside the class definition.
D) Have the option of including the optional statement template< typename Type >.
Correct Answer
verified
Multiple Choice
A) Function-template specializations are generated by the compiler, not the programmer.
B) Function-template specializations cannot accept user-defined types.
C) Function-template specializations do not perform identical operations on each data type.
D) Overloaded functions usually do not perform similar operations on each data type.
Correct Answer
verified
Multiple Choice
A) A class-template specialization can be used to derive a class template.
B) A class template can be derived from a nontemplate class.
C) A non-template class can be used to derive a class-template specialization.
D) A non-template class can be derived from a class template-specialization.
Correct Answer
verified
Multiple Choice
A) Are identical to macros.
B) Are generated at compile time.
C) Have a maximum allowed number of type parameters.
D) Are not more concise than the equivalent set of overloaded functions.
Correct Answer
verified
Multiple Choice
A) Can include objects of template classes as parameters.
B) Must have return type T.
C) Do not need a separate template< typename type > statement if they take objects from a template class as a parameter.
D) Do not need a separate template< typename type > statement.
Correct Answer
verified
Multiple Choice
A) Unable to have default arguments.
B) Specified before the angle-bracket-enclosed type-parameter list.
C) const.
D) Required for class templates.
Correct Answer
verified
Multiple Choice
A) If the class template also has nontype parameters.
B) If the class template does not have any nontype parameters.
C) If the class is used as a container class.
D) As the rightmost trailing) parameters in a template's type-parameter list.
Correct Answer
verified
Multiple Choice
A) Using other function templates with the same function name and parameters.
B) Using non-template functions with the same name and different parameters.
C) Using non-template functions with a different name but the same parameters.
D) Using other function templates with a different name but the same parameters.
Correct Answer
verified
Multiple Choice
A) template< typename T > T square T num )
B) template< typename T1, typename T2 > T1 square T1 num1, T2 num2 )
C) int square int num )
D) double square double num )
Correct Answer
verified
Showing 1 - 13 of 13
Related Exams