Deck 18: Introduction to Custom Templates

ملء الشاشة (f)
exit full mode
سؤال
Assuming that all four of the following functions are defined, which one will be called by the function call square(23.4)?

A) template T square(T num)
B) template T1 square(T1 num1, T2 num2)
C) int square(int num)
D) double square(double num)
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
A function template can be overloaded by:

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.
سؤال
Function templates:

A) Can include objects of template classes as parameters.
B) Must have return type T.
C) Do not need a separate template statement if they take objects from a template class as a parameter.
D) Do not need a separate template statement.
سؤال
Default type parameters are allowed only:

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.
سؤال
Which of the following is true?

A) Only class templates may specify default type arguments for type parameters.
B) Only function templates may specify default type arguments for type parameters.
C) As of C++ 11, you can use default type arguments for template type parameters in function templates.
D) None of the above.
سؤال
Class templates:

A) May include the statement template anywhere.
B) Must put template before the class definition.
C) Must include template inside the class definition.
D) Have the option of including the optional statement template.
سؤال
Nontype parameters are:

A) Unable to have default arguments.
B) Specified before the angle-bracket-enclosed type-parameter list.
C) Constants.
D) Required for class templates.
سؤال
The relationship between function templates and function-template specializations is most similar to the relationship between:

A) Classes and objects.
B) Classes and functions.
C) Functions and return types.
D) Headers and source files.
سؤال
For a class template, the scope resolution operator (::) is needed:

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.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/9
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 18: Introduction to Custom Templates
1
Assuming that all four of the following functions are defined, which one will be called by the function call square(23.4)?

A) template T square(T num)
B) template T1 square(T1 num1, T2 num2)
C) int square(int num)
D) double square(double num)
D
2
A function template can be overloaded by:

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.
B
3
Function templates:

A) Can include objects of template classes as parameters.
B) Must have return type T.
C) Do not need a separate template statement if they take objects from a template class as a parameter.
D) Do not need a separate template statement.
A
4
Default type parameters are allowed only:

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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 9 في هذه المجموعة.
فتح الحزمة
k this deck
5
Which of the following is true?

A) Only class templates may specify default type arguments for type parameters.
B) Only function templates may specify default type arguments for type parameters.
C) As of C++ 11, you can use default type arguments for template type parameters in function templates.
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 9 في هذه المجموعة.
فتح الحزمة
k this deck
6
Class templates:

A) May include the statement template anywhere.
B) Must put template before the class definition.
C) Must include template inside the class definition.
D) Have the option of including the optional statement template.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 9 في هذه المجموعة.
فتح الحزمة
k this deck
7
Nontype parameters are:

A) Unable to have default arguments.
B) Specified before the angle-bracket-enclosed type-parameter list.
C) Constants.
D) Required for class templates.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 9 في هذه المجموعة.
فتح الحزمة
k this deck
8
The relationship between function templates and function-template specializations is most similar to the relationship between:

A) Classes and objects.
B) Classes and functions.
C) Functions and return types.
D) Headers and source files.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 9 في هذه المجموعة.
فتح الحزمة
k this deck
9
For a class template, the scope resolution operator (::) is needed:

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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 9 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 9 في هذه المجموعة.