Question # 1

(TCO 3) Two common relationships exist between classes—“is a” and “has a”. What kind of concept does each relationship represent? Give real world examples that demonstrate each of the relationships.

 

 

Question # 2

 (TCO 2) Given the following program description,

Program Description - You have been asked to create a program designed to keep track of the inventory in a person's house. The program must keep track of all items owned by the house's resident and their specific location in the house. A single room can contain any number of items and every item should have a unique ID to differentiate it from all the other items. (Points : 18)

• identify the required classes/objects necessary to achieve the program requirements;

• briefly describe any relationships that might exist between your classes; and

• briefly describe the overall hierarchy of your proposed classes.

 

 

Question # 3

 (TCO 2) Define and implement the overloaded constructors that support the following test function for a Date class. The data members for the Date class are:

• year - integer number

• month - integer number

• day - integer number

int main()

{ Date d1(); //d1 will take all default values

Date d2(2011, 8, 2); //d2 will take all supplied values

Date d3(2011); //d3 will take supplied year, month and day will take default values

Date d4(2011, 9); //d4 will take supplied year and month, day will take default value

Date d5 = d2; //d5 will take the same value as d2

//the rest of the code

}

 

 

 

Question # 4

 (TCO 1) Which of the following statements is/are true? (Points : 5)

A. The implementation details of a class can change, so they need to be visible.

B. An object is necessary to be defined before you can create a class.

C. The state of an object is defined as the attributes and behaviors of that object.

D. An interface of a class defines what messages an object can respond to.

All are true

None are true

Only A, C, and D are true

Question # 5

 

(TCO 2) Which of the following components of a class definition do not have a return type? (Points : 5)

Public member methods

Accessor/mutator methods

Constructors

Private member methods

None of the above

 

Question # 6

 (TCO 7) _____ enforce a(n) _____ which is a methodology used in object-oriented programming to forces programmers to adhere to certain "rules." (Points : 5)

Abstract classes; contract

Static variables; hierarchy

Classes; transitive communication

Method signatures; encapsulation

None of the above

Question # 7

 (TCO 4) Why might it be better to create a derived class instead of adding a few lines of code to an existing Class? (Points : 5)

Simplifies testing

No need to re-test the previously written class

Saves time on debugging the program

All of the above

None of the above

 

    • 7 years ago
    7 Questions
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      essaysquestions.docx