Page 1

Full file at http://testbank360.eu/test-bank-data-structures-using-c-2nd-edition-malik

Ch02 True/False Indicate whether the statement is true or false. ____

1. The base class inherits all its properties from the derived class.

____

2. Inheritance is an ‘‘is-a’’relationship.

____

3. In single inheritance, the derived class is derived from a single base class.

____

4. A derived class inherits all its data members from the base class; it has none of its own.

____

5. In multiple inheritance, the derived class is derived from more than one base class.

____

6. Private members of a base class can be accessed by a derived class.

____

7. A derived class cannot directly access public members of a base class.

____

8. The derived class can redefine public member functions of a base class.

____

9. Overriding a member function is the same as redefining it.

____ 10. Redefining a member function is the same as overloading the member function. ____ 11. A class cannot have a constructor with default parameters. ____ 12. A derived class cannot have a constructor with default parameters. ____ 13. Header files of new classes contain commands that tell the computer where to look for definitions of the base class. ____ 14. A derived class can directly access the protected members of a base class. ____ 15. Composition is a “has-a” relationship. ____ 16. In C++ the user can create new operators. ____ 17. Default arguments can be used with an overloaded operator. ____ 18. When overloading an operator, the meaning of how an operator works with built-in types remains the same. ____ 19. In C++, every object of a class maintains a hidden pointer to itself, and the name of this pointer is “hidden”. ____ 20. A friend function is a member function of a class but only has access to the class’s public data members. ____ 21. When writing the definition of a friend function, the name of the class and the scope resolution operator do not precede the name of the friend function in the function heading. ____ 22. The function that overloads any of the operators (), [], ->, or = for a class must be declared as a member of the class. ____ 23. For efficiency purposes, wherever possible, you should overload operators as nonmember functions. ____ 24. By using templates, you can write a single code segment for a set of related functions. ____ 25. Just as variables are parameters to functions, data types are parameters to templates. Multiple Choice Identify the choice that best completes the statement or answers the question.


Full file at http://testbank360.eu/test-bank-data-structures-using-c-2nd-edition-malik

____ 26. Inheritance is an example of a(n) “____” relationship. a. is-a c. friend of b. has-a d. member of ____ 27. The new class that we create from the existing classes is called the ____. a. base class c. derived class b. modifier class d. extended class ____ 28. In single inheritance, the derived class is derived from ____base class(es). a. one c. three or more b. two d. virtual ____ 29. If there are three classes, shape, circle, and square, what is the most likely relationship among them? a. The square class is a base class, and shape and circle are derived classes of square. b. The shape class is a base class, and circle and square are derived classes of shape. c. The shape, circle, and square classes are all sibling classes. d. These three classes cannot be related. ____ 30. If class dog has a derived class retriever, which of the following is true? a. In the case of single inheritance, dog can have no other derived classes. b. In the case of single inheritance, retriever is derived from no other class except dog. c. The relationship between these classes implies that dog “is a” retriever. d. The relationship between these classes implies that retriever “has-a” dog. ____ 31. To redefine a public member function of a base class in the derived class, the corresponding function in the derived class must have ____. a. the same name, number, and types of parameters b. only the same name and types of parameters c. only the same name and number d. only the same number and types of parameters ____ 32. We need to ensure that the private member variables that are inherited from the base class are initialized when a ____ of the derived class executes. a. destructor c. copy constructor b. constructor d. friend function ____ 33. The scope resolution operator is ____. a. : c. :: b. * d. ; ____ 34. When you declare a derived class object, this object inherits the members of the base class, but the derived class object cannot directly access the ____. a. private data members of the base class b. data members in its own class c. base class constructors d. public data members of the base class ____ 35. A(n) ____ typically serves to initialize the member variables of a derived class. a. inheritor c. deconstructor b. initiator d. constructor ____ 36. A call to the base class constructor is specified in the ____ of a derived class constructor. a. body of the definition c. heading of the definition b. body of the constructor d. heading of the constructor ____ 37. If a class contains the default constructor and no values are specified when the object is declared, the ____ executes and initializes the object. a. default destructor c. last constructor in the program listing


Full file at http://testbank360.eu/test-bank-data-structures-using-c-2nd-edition-malik

____ 38.

____ 39.

____ 40.

____ 41.

____ 42.

____ 43.

____ 44.

____ 45.

____ 46.

____ 47.

____ 48.

____ 49.

____ 50.

b. first destructor in the program listing d. default constructor To define new classes, you create new ____ files. a. header c. prototype b. friend d. placeholder The definitions of member functions can be placed in a separate file whose extension is ____. a. .cxx c. .cpp b. .c d. .cc To include a system-provided header file, such as iostream, in a user program, you enclose the header file between ____. a. curly brackets c. asterisks b. angular brackets d. square brackets To include a header file in a program, you use the preprocessor command ____. a. pragma c. pull b. fetch d. include For a base class to give access to a member to its derived class and still prevent its direct access outside the class, you must declare that member under the member access specifier ____. a. private c. public b. protected d. shared In ____, one or more members of a class are objects of another class type. a. inheritance c. composition b. redefinition d. encapsulation Composition is a(n) “____� relationship. a. is a c. was a b. has a d. had a The arguments to the constructor of a member object are specified in the ____ part of the definition of the constructor of the class. a. body c. scope b. pragma d. heading The ability to combine data and operations is called ____. a. inheritance c. redefinition b. encapsulation d. composition By using templates, you can write a single code segment for a set of related functions, called a ____. a. function template c. class set b. function type d. class template Like function templates, ____ are used to write a single code segment for a set of related classes. a. function types c. inherited classes b. class templates d. protected members Class templates are called ____ types. a. abstract c. template b. general d. parameterized Passing parameters to a function has an effect at ____ time. a. compile c. run b. link d. build


Full file at http://testbank360.eu/test-bank-data-structures-using-c-2nd-edition-malik

Ch02 Answer Section TRUE/FALSE 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25.

ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS:

F T T F T F F T T F F F T T T F F T F F T T F T T

PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF:

60 60 60-61 60|62 61 62 62 62 63 63 71 71 75 78 79 86 87 87 87 91 91 94 102 108 109

PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS:

1 1 1 1 1 1 1 1 1 1 1 1 1

REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF:

60 60 60-61 61 61 63 63 67 69 69 70 70 75

MULTIPLE CHOICE 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38.

ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS:

A C A B B A B C A D C D A


Full file at http://testbank360.eu/test-bank-data-structures-using-c-2nd-edition-malik

39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50.

ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS:

C B D B C B D B A B D C

PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS:

1 1 1 1 1 1 1 1 1 1 1 1

REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF:

76 76 76 78 79 79 83 84 108 111 111 112

Test bank data structures using c 2nd edition malik  

test bank data structures using c 2nd edition malik. Full file at http://testbank360.eu/test-bank-data-structures-using-c-2nd-edition-m...

Read more
Read more
Similar to
Popular now
Just for you