Please only Answer if you are sure you are right. Negative reviews will be given
ID: 3696961 • Letter: P
Question
Please only Answer if you are sure you are right. Negative reviews will be given for wrong answers.
1B.
Select one:
a. swap(s1,s2);
b. swap(int1, int2);
c. swap(ch1, ch2);
d. swap(int1, ch2);
2B.
Given that you have two versions of a function that are the same except that one expects some integer parameters, and the other expects a float and an integer parameter, which parameters would you change to a T in order to make this a template function?
Select one:
a. the parameter that always stays an integer
b. the parameter that is an integer in one function and a float in the other function.
c. Both parameters change.
d. Neither parameter changes.
3B.
If you want to make a function a template function, you must precede the function declaration and definition with
Select one:
a. template
b. template
c. template
d. template
4B.
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?
Select one:
a. the < operator
b. the > operator
c. the = operator
d. the == operator
5B.
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?
Select one:
a. 1
b. 2
c. 3
d. 4
Explanation / Answer
1B) d
swap(int1, ch2)
2B) d
3B) c
template <class T>
4B) d
the == operator
5B) c
3