Exam 17: Templates

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

Given a search template function that will look for an occurrence of target in an array of items, what is necessary for the instantiating data type to implement?

(Multiple Choice)
4.8/5
(36)

Classes can be defined as templates.

(True/False)
4.8/5
(31)

If you have a class template declared and you instantiate it in you program twice once with an integer, once with a string), how many versions of the class does the compiler create?

(Short Answer)
4.8/5
(31)

Which of the following describes a class that would be a good candidate for conversion to a template class?

(Multiple Choice)
4.9/5
(36)

If you define some list class template in your program, and then declare a list of integers, 2 lists of doubles and 1 list of strings, how many different version of the template class will the compiler provide?

(Multiple Choice)
4.8/5
(36)

If you have a class template declared and you instantiate it in you program twice both times it is instantiated with an integer), how many versions of the class does the compiler create?

(Short Answer)
4.8/5
(39)

In a class template implementation, every use of the class name as the name of the class should be followed by <T>.

(True/False)
4.9/5
(32)

Writing a template class

(Multiple Choice)
4.7/5
(30)

If you define a function template, then the compiler will create a separate function definition for every data type that exists.

(True/False)
4.7/5
(36)

A class template may not use dynamic memory allocation.

(True/False)
4.8/5
(39)

Which of the following is a correct template prefix?

(Multiple Choice)
4.9/5
(35)

When would you want to make a function a function template?

(Multiple Choice)
4.8/5
(36)

The C++ code template <class T> is called the ______________________

(Short Answer)
4.9/5
(38)

In the following function template, what must be true in order to use the function with a given data type? Template <class T> Int smallest T array[], int size) { Int small=0, i; Fori=0;i<size;i++) { Ifarray[i] < array[small]) Small=i; } Return small; }

(Multiple Choice)
4.8/5
(37)

In a template function definition, all parameters must be of the template class T).

(True/False)
4.7/5
(37)
Showing 21 - 35 of 35
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)