Tco 2: Discussion Questions

588 Words3 Pages
TCO 2) Only those class members that are presented to the users of the class are part of the ______ of the class. (Points : 2) interface implementation constructors superclass | 2. (TCO 2) _____ and _____ are other terms for getters and setters. (Points : 2) Constructors; destructors Public; private Retrievals; putters None of the above | 3. (TCO 2) Which of the following statements is/are true? (Points : 2) If a method is public, it is considered part of the class implementation. If you declare an attribute as private, you do not have to worry about tracking down every piece of code that might have changed the attribute when debugging. While designing a class you add as many interfaces as possible, trying to cover all…show more content…
(TCO 2) A Waiter is responsible for taking the order from the Customer based on the menu, informing the Chef of the order and delivering the requested food back to the Customer. A Chef is responsible for preparing the food and notifying the Waiter when the food is ready. The Customer is responsible for placing an order from the menu. In identifying the interface of the Customer object, which of the following would you consider as (an) appropriate message(s) the Customer should respond to? (Points : 2) “How old are you?” “How would you like your steak? Rare, medium rare, or well done?” “What would you like to eat?” All of the above Only B and C | 5. (TCO 5) Code inside a _____ should set the newly created object to its initial _____ state. (Points : 2) method; public constructor; private class; persistent constructor; stable | 6. (TCO 5) Which of the following method pairs are not examples of method overloading? (Points : 2) public void Roll() ; public int Move(int x) public int Charge(int x) ; public int Charge(int y) public int Subtract() ; public void Subtract() All of the above only B | 7. (TCO 5) Consider the following class definition. class Rose { private: int petals; double cost; public: Rose()…show more content…
(i) The data member cost can be set to a new value, by a user of this class (ii) cout<<”The rose has: “ << Rose.getPetals() << “ petals.”; is a valid statement (iii) There is a destructor in the class (Points : 2) i. ii Only i and iii None are true All are true | 8. (TCO 2) Can two methods each define a local variable with the same name? (Points : 2) Yes, as long as the variable is used in the same way. No, this is not possible because the compiler would not know which variable to use. Yes, but only if the methods have the same name. None of the above | 9. (TCO 5) Which error handling technique(s) is/are appropriate when developing an application? (Points : 2) Check for potential problems and abort the application when a problem is encountered. Check for potential problems and throw an exception. Check for potential problems, catch the mistake, and try to fix it. All of the above | 10. (TCO 2) Assume a class contains two non-static data members and one static data member. If two objects have been instantiated from the class, how many copies of the static data member exist? (Points : 2) 3 6 2 1

More about Tco 2: Discussion Questions

Open Document