1. Writing two or more functions with the same name, but with different argument
ID: 3561422 • Letter: 1
Question
1. Writing two or more functions with the same name, but with different argument lists, is known as ___________.
a. overloading
b. creating a template
c. orienting
d. inheritance
2. Creating a function template is most appropriate when ___________.
a. you want a function to take multiple arguments
b. you need several functions with the same name, but the logic is different depending on the arguments
c. you are writing several functions that take different argument types, but use the same logic
d. you want only one version of a function to exist so as to avoid confusion
3. A group of functions that generates from the same template is often called ___________.
a. a class
b. a family of functions
c. a polymorphic template
d. an assembly
4. Another term for parameterized is ___________.
a. polymorphic c.
b. template
c. generic
d. object-oriented
5. In the template definition template, Dstands for ___________.
a. double c. any built-in type
b. any class or type
d. any programmer-created class
6. The compiler determines the parameterized type in a function template ___________.
a. polymorphically
b. explicitly
c. duplicitly
7. Template functions can receive ___________.
a. only one parameter
b. one or two parameters
c. any number of parameters
d. no parameters
8. Function templates ___________.
a. are overloaded automatically
b. can be overloaded
c. are never overloaded
d. can be overloaded, but seldom are in common programming practice
9. A function template argument list can contain ___________.
a. only parameterized types
b. only nonparameterized types
c. any combination of parameterized and nonparameterized types
d. either parameterized or nonparameterized types, but not both in the same argument list
10. You explicitly name a type in a function template call ___________.
a. always
b. never
c. to override an implicit type
d. to overload the function
11. When a function template has two parameterized types, one as the return value, and one
as an argument, then ___________.
a. the first type must be explicitly coded
b. the first type must not be explicitly coded
c. the second type must be explicitly coded
d. both types must be explicitly coded
12. When you use a class object with a function template, you must ___________.
a. supply a default constructor for the class
b. not use scalar types with the function
c. overload the function template
d. define any operation used within the function template within the class
13. A template class is a class in which ___________.
a. at least one type is parameterized
b. at least one field is not generic
c. no fields are generic
d. all types are parameterized
14. Which of the following is a template definition?
a. template<T>
b. template<classT>
c. template class <T> d. <template class T>
15. To create an Order template class object named backOrder and assign 0 as the
argument to the constructor, the proper syntax is ___________.
a. Order backOrder = 0;
b. Order<int> backOrder = 0;
c. Order<int> backOrder(0);
d. Order backOrder<int>(0);
16. When you create a template class, ___________.
a. each of its functions must be overloaded
b. its functions can receive only a single argument
c. the list of types the template can use to replace the generic type must be specified in the class header
d. none of the above
17. A template class that has been written to perform common class tasks, such as linking
lists or sorting, is a(n) ___________class.
a. overloaded
b. bottle
c. container
d. parameter
18. Each link in a linked list is usually made up of ___________.
a. two or more objects
b. an object and a pointer
c. an object and a function
d. an object, a function, and a pointer
19. The advantage to creating container classes is that ___________.
a. you don
Explanation / Answer
1. Overload functions if create functions with the same name but with different parameter lists (argument lists).
Thus the correct option is a) overloading
2) Writing several functions that take different argument types, but use the same logic used in function template.
Thus the correct option is (c)
3) A group of functions that generates from the same template is often called a family functions.
Thus the correct option is (b) a family of functions
4) A generic, or parameterized, argument is one that can stand for any number of C++ types.
Thus the correct option is c) generic.
5) In the template definition template <class D>, D stands for programmer-created class.
Thus the correct option is d) any programmer-created class.
6) The designation of the parameterized type is implicit by compiler
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.