Module 5

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

23. In the following statement, which is the derived class? class Car : protected Vehicle a. Car b. Vehicle c. protected d. Cannot be determined e. None of these

a. Car

18. ________ is commonly used to extend a class, or to give it additional capabilities. a. Inheritance b. Privacy c. The constructor d. The destructor e. None of these

a. Inheritance

30. The base class access specification can be viewed as a filter that base class members must pass through when becoming inherited members of a derived class. a. True b. False

a. True

31. When arguments must be passed to the base class constructor, they are passed from the derived class constructor's header line. a. True b. False

a. True

33. Static binding occurs when the compiler binds a function call with the function call that resides in the same class as the call itself. a. True b. False

a. True

34. Pointers to a base class may be assigned the address of a derived class object. a. True b. False

a. True

21. A virtual function is declared by placing the keyword ________ in front of the return type in the base class's function declaration. a. virtual b. private c. public d. protected e. None of these

a. virtual

27. In an inheritance situation, you may not pass arguments to a base class constructor. a. True b. False

b. False

32. A member function of a derived class may not have the same name as a member function of a base class. a. True b. False

b. False

1. ________ allows us to create new classes based on existing classes. a. Polymorphism b. Inheritance c. Function overloading d. The copy constructor e. None of these

b. Inheritance

24. In the following statement what is being protected? class Car : protected Vehicle a. derived class functions b. base class members c. derived class data d. future inherited classes e. None of these

b. base class members

17. The ________ destructor is called before the ________ destructor. a. base, derived b. derived, base c. public, private d. private, public e. None of these

b. derived, base

5. The ________ constructor is called before the ________ constructor. a. base, derived b. derived, base c. public, private d. private, public e. None of these

b. derived, base

22. Multiple inheritance is when a ________ class has ________ base classes. a. base, no b. derived, two or more c. derived, no d. compound, more than two e. None of these

b. derived, two or more

9. The compiler performs ________ on virtual functions. a. static binding b. dynamic binding c. additional error checking d. no special services e. None of these

b. dynamic binding

7. The term ________ means the ability to take many forms. a. inheritance b. polymorphism c. member function d. encapsulation e. None of these

b. polymorphism

15. The base class's ________ affects the way its members are inherited by the derived class. a. name b. return data type c. access specification d. name and return data type e. None of these

c. access specification

2. When you derive a class from an existing class, you ________ add new data and functions. a. may never b. may sometimes c. may d. None of these

c. may

25. Polymorphism is when ________ in a class hierarchy perform differently, depending upon which object performs the call. a. base class constructors b. derived class destructors c. member functions d. derived class constructors e. None of these

c. member functions

20. A virtual function is a member function that expects to be ________ in a derived class. a. ignored b. called frequently c. overridden d. private e. None of these

c. overridden

19. When member functions behave differently, depending upon which object performed the call, this is an example of ________. a. chaos theory b. virtual insubordination c. polymorphism d. encapsulation e. None of these

c. polymorphism

16. Protected members of a base class are like ________, but they may be accessed by derived classes. a. constructor functions b. static members c. private members d. public members e. None of these

c. private members

3. The base class access specification determines how ________ members in the base class may be accessed by derived classes. a. private b. public c. protected d. All of these e. None of these

d. All of these

10. ________ to a base class may be assigned the address of a derived class object. a. Access specifiers b. Static members c. Private members d. Pointers e. None of these

d. Pointers

26. ________ functions are dynamically bound by the compiler. a. Constructor b. Destructor c. Static d. Virtual e. None of these

d. Virtual

14. In an inheritance situation, the new class that you create from an existing class is known as the ________ a. derived class b. inheritee c. child class d. derived class and child class e. None of these

d. derived class and child class

6. A ________ of a base class expects to be overridden in a derived class. a. constructor function b. destructor function c. static function d. virtual function e. None of these

d. virtual function

12. Arguments are passed to the base class destructor function by the ________ class ________ function. a. derived, constructor b. derived, destructor c. base, constructor d. base, destructor e. None of these

e. None of these

13. The following statement allows the ________ members of the Car class to access ________ members of the Vehicle class. class Car : public Vehicle a. private, private b. public, private c. protected, private d. public, protected e. None of these

e. None of these

29. A derived class may become a base class, if another class is derived from it. a. True b. False

a. True

35. A derived class may not have any classes derived from it. a. True b. False

b. False

4. ________ members of a base class are never accessible to a derived class. a. Public b. Private c. Protected d. All of these e. None of these

b. Private

11. In the statement which is the base class? class Car : public Vehicle a. Car b. Vehicle c. public d. class e. None of these

b. Vehicle

8. When the compiler binds a member function call with the version of the function that resides in the same class as the call itself, this is considered ________ binding. a. local b. safe c. static d. dynamic e. None of these

c. static

28. More than one class may be derived from a base class. a. True b. False

a. True


Kaugnay na mga set ng pag-aaral

Module 3: 3.04, 3.06, and 3.07 Lessons

View Set

Sports Medicine Semester 1 Final

View Set

series 66 - practice exam review

View Set