Answered! c++ 1. (TCO 3) Which of the following about composition is true? (Points : 2)        Composition promotes code reuse….

c++

1. (TCO 3) Which of the following about composition is true? (Points : 2)

Don't use plagiarized sources. Get Your Custom Essay on
Answered! c++ 1. (TCO 3) Which of the following about composition is true? (Points : 2)        Composition promotes code reuse….
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
Order Essay

Composition promotes code reuse.
Class composition means a class contains objects from another class.
Inheritance and composition can be used together.
All of the above

Question 2. 2. (TCO 4) Select the false statement regarding inheritance. (Points : 2)

A child class can have more functionality than parent class.
A child class can itself be parent class.
Common functionality needs to be designed in the parent class.
Parent classes are usually more specific child classes.

Question 3. 3. (TCO 4) Select the parent class. (Points : 2)

Manager
Executive
Person
Staff

Question 4. 4. (TCO 4) Which of the following is not a good example of a hierarchy that could be modeled by
inheritance? (Points : 2)

Airplanes
Geometric shapes
Animals
Prime numbers

Question 5. 5. (TCO 4) Which of the following examples represent the “is-a” relationship in the parent/child format? (Points : 2)

person/employee
person/student
student/international student
All of the above

Question 6. 6. (TCO 3) Which of the following are the benefits of composition? (Points : 2)

Systems can be tested independently.
Systems can be built independently.
Systems can be maintained independently.
All of the above

Question 7. 7. (TCO 3) In object-oriented programming, inheritance is transitive; that means a child class _____. (Points : 2)

inherits only from its parent class
inherits only selected methods and fields
inherits all the methods and fields of all its ancestors
does not inherit any methods or fields

Question 8. 8. (TCO 4) What inheritance mode is the most general one? (Points : 2)

Private
Default
Public
Protected

Question 9. 9. (TCO 4) Composition is a means of allowing _____. (Points : 2)

reusability in object oriented programming
objects to communicate
identification of classes
All of the above

Question 10. 10. (TCO 6) The whole list of parent classes from which a child class is derived constitutes the _____ of the child class (Points : 2)

family
ancestors
role
subset

Expert Answer

 1.D

All of the above
Because both the inheritance and also composition can promote code reuse and also both these can be used together.

2.C
Common functionality needs to be designed in the parent class this statement represents false because it is not mandatory to write the common functionality in parent class we can also write in the child class and that child class can be act as parent class.

3.A
manager is the parent class because we can inherit all the remaining people from him he will act as parent classs.

4. A
Airplanes is not a good example of a hierarchy that could be modeled by inheritance.

5.D
“is-a” relationship satisfies all the conditions

6.D
Systems can be tested, built and can be maintained independently.

7.C
In object-oriented programming, inheritance is transitive; that means a child class inherits all the methods and fields of all its ancestors.

8.C
Public inheritance mode is the most general one because the child class can be inherit easily through out the application.

9.D
Composition is reusability in object oriented programming and also objects to communicate and identification of classes.

10.B
The whole list of parent classes from which a child class is derived constitutes the ancestors of the child class.

Still stressed from student homework?
Get quality assistance from academic writers!