Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Download: http://solutionzip.com/downloads/question-1-1-tco-1-which-of-the-following-would-be-the-most-appropriate-choice-for-a-method-in-a-book-class/
- Question 1.1. (TCO 1) Which of the following would be the most appropriate choice for a method in a Book class? (Points : 5)
- Author()
- NumberChapters()
- Publish()
- Language()
- Question 2.2. (TCO 1) Object-oriented programming generally focuses on _____. (Points : 5)
- A. separating the interface from the implementation
- B. client side access to implementation details
- C. creating as many classes as possible
- D. code reuse with classes
- All of the above
- None of the above
- Only A and D
- Question 3.3. (TCO 2) Which of the following components of a class definition cannot be overloaded? (Points : 5)
- Public member methods
- Destructors
- Constructors
- Private member methods
- All of the above
- Question 4.4. (TCO 2) Which of the following statements is/are true? (Points : 5)
- A. A default constructor is automatically created for you if you do not define one.
- B. A static method of a class can access non-static members of the class directly.
- C. An important consideration when designing a class is identifying the audience, or users, of the class.
- None of the above
- Only A and C
- Question 5.5. (TCO 5) Which of the following method pairs are examples of method overloading? (Points : 5)
- A. public void Bake() ; public int Bake(int x)
- B. public int Mix(int x, int y, int z) ; public int Mix(int y, int x, int z)
- C. public int Shake(int x, int y) ; public int Shake(int x, int y, int z)
- All of the above
- Only A and C
- Question 6.6. (TCO 1) Which of the following statements is/are false? (Points : 5)
- Abstraction is the process of ignoring the high level information about a category entity or activity, while concentrating on the “unimportant” details.
- The object oriented paradigm permits the modeling of a software system in a more natural way compared to the procedural paradigm.
- In object-oriented programming we design the program as a set of cooperating objects.
- None of the above
- Question 7.7. (TCO 2) You have been tasked to create an Automobile class and your boss wants you to consider the concept of encapsulation as you design your class. Which of the following actions will you take? (Points : 5)
- Declare as many class attributes public as you can, creating accessor/mutators for each one.
- Package attributes and behaviors specific to an Automobile together.
- Make sure to include a specific implementation for a drive method that all subclasses can inherit.
- Declare the class as private.
- All of the above
- Question 8.8. (TCO 2) You are given an Animal class that was designed with the concept of a black box in mind. You need to integrate the Animal class into your own code. The first thing you need to figure out is a list of _____ and _____ that are associated with the class. The actual implementation details need not be known. (Points : 5)
- interfaces; the detailed implementations
- inputs; outputs
- private methods; accessors
- relationships; UML diagrams
- Question 9.9. (TCO 2) A class is designed with two public attributes: attributeOne and attributeTwo. attributeOne is an integer data type while attributeTwo is a string data type. Which pseudocode representation(s) of setters would be appropriate for this class? (Points : 5)
- A. int setAttributeOne(int newAttributeOne)
- {
- return attributeOne
- }
- B. void setAttributeOne(int newAttributeOne)
- {
- attributeOne = newAttributeOne
- }
- C. string setAttributeTwo (int newAttributeTwo)
- {
- attributeTwo = newAttributeTwo
- }
- D. void setAttributeTwo ()
- {
- attributeTwo = “ “
- }
- Both A and C
- None of the above
- Question 10.10. (TCO 7) Which of the following statements is true? (Points : 5)
- Interfaces must implement a default constructor if even one multi-arg constructor is also implemented.
- Interfaces are defined and implemented inside an abstract class.
- Methods listed in an interface must be implemented when used by another class.
- At least one interface should be used in any inheritance hierarchy.
- Question 11.11. (TCO 7) In an object-oriented program, a(n) _____ might be found in a(n) _____ and/or a(n) _____. (Points : 5)
- object; attribute; base class
- method with no implementation; abstract class; interface
- interface; base class; abstract class
- None of the above
- Question 12.12. (TCO 7) Programmers may be forced to adhere to a contract or a specification defined by a framework due to the use of _____ and _____. (Points : 5)
- abstract classes; constants
- abstract classes; interfaces
- base classes; abstract methods
- has-a; is-a relationships
- None of the above
- Question 13.13. (TCO 4) If you have a complete, working Circle class that has been thoroughly tested, and you wish to add an overloaded area() method that can calculate the area of a Cylinder, how should this be accomplished? (Points : 5)
- Add the method to your existing Circle class.
- Derive a new class Cylinder from the Circle class.
- Make a brand new class.
- Add the method in the same class as the Main method.
- Question 14.14. (TCO 3) An Order class and RushOrder class have what type of relationships? (Points : 5)
- The Order has-a RushOrder.
- The Order is-a RushOrder.
- The RushOrder has-an Order.
- The RushOrder is-an Order.
- Question 15.15. (TCO 4) Which of the following is true about an inheritance hierarchy? (Points : 5)
- It is not a good practice to have deeply layered inheritance hierarchies.
- When an inheritance hierarchy is too deep, it is easy to lose track of the members in the great-grandchildren classes.
- Inheritance hierarchies are easier to implement than to design.
- All of the above
- None of the aboveQuestion 1.1. (TCO 4) Suppose class Child is derived from class Parent that was in turn derived from class GrandParent. When we declare an object of class Child, three constructors are called: i) Child, ii) Parent, iii )GrandParent.What is the order in which these three constructors are invoked? (Points : 5)
- Child, Parent, GrandParent
- Parent, GrandParent, Child
- GrandParent, Child, Parent
- GrandParent, Parent, Child
- Question 2.2. (TCO 6) The ability to reuse objects already defined, perhaps for a different purpose, with modification appropriate to the new purpose, is referred to as: (Points : 5)
- Information hiding
- Inheritance
- Redefinition
- Overloading
- Question 3.3. (TCO 4) Which of the following is not a good example of a hierarchy that could be modeled with inheritance? (Points : 5)
- Airplanes
- Geometric shapes
- Animals
- Prime numbers
- Question 4.4. (TCO 8) Data/information hiding and encapsulation improves construction and maintenance because: (Points : 5)
- Adding additional details is isolated to a single class.
- Program bugs are isolated to a single class.
- Programming to an interface makes the code more logical.
- All of the above
- None of the above
- Question 5.5. (TCO 8) What are some of the characteristics of “self-documenting” code? (Points : 5)
- Logical identifier names
- Value-adding comments
- Straightforward algorithms
- All of the above
- None of the above
- Question 6.6. (TCO 9) Which of the following allow a programmer to reduce the complexity of an object-oriented program? (Points : 5)
- Creating each class in a separate file
- Using namespaces as a container for logically related items
- Using namespaces to create global types
- All of the above
- None of the above
- Question 7.7. (TCO 2) Which of the following is a proper implementation for a setter? (Points : 5)
- int SetNumberOfLegs() { return legs;}
- void SetNumberOfLegs (int legs) {this.legs = legs;}
- void SetNumberOfLegs (int legs) {return legs;}
- void SetNumberOfLegs () {return legs;}
- Question 8.8. (TCO 7) Which of the following declares an abstract method in an abstract class? (Points : 5)
- public abstract CalculateTip();
- public abstract double CalculateTip();
- public double abstract CalculateTip();
- public double CalculateTip() {}
- Question 9.9. (TCO 1) Assuming a class definition of a Dog that has a default constructor and constructor that accepts three string arguments, and the appropriate properties defined, how many objects are created in the code below?
- static void Main(string[] args)
- {
- Dog newObject;
- Dog newDogObject = new Dog();
- Dog newDog = new Dog(“Dog”, “Jack”, “Labrador”);
- Dog newDoggie = new Dog(); ;
- newObject = newDogObject;
- newDoggie = newDog;
- }
- }
- (Points : 5)
- 2
- 6
- 3
- 4
- Question 10.10. (TCO 8) If you were a manager and wanted to address best practices in choosing appropriate names for attributes and their associated accessor/mutator properties, what would you say? (Points : 18)
- Question 11.11. (TCO 2) Does Encapsulation imply Data/Information Hiding in object-oriented programming? Why or why not? (Points : 18)
- Question 12.12. (TCO 2) Given the following program description,
- – 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.
- Program Description – You have been asked to create a program designed to keep track of students enrolled at a certain college. The program must keep track of all students and the department they belong to. A single department can contain any number of students and every student should have a unique id to differentiate them from all the other students. (Points : 18)
- Question 13.13. (TCO 7) Briefly describe what an Interface is and how it can be used in an object-oriented program. Provide example pseudocode showing how an IPerson Interface might be constructed. (Points : 18)
- Question 1.1. (TCO 2) Keeping in mind all object-oriented programming best practices, create a class for a Computer, with the following specifications:
- 1) Specify two data members
- 2) Default Constructor
- 3) Overloaded Constructor which takes both data member values as input.
- 4) Generate a unique identification number for each object instantiated from this class. Use a static data member to keep track of the identification number last assigned to an object so that duplications will not occur. Code the necessary portion of the class definition so as to support this requirement.
- 5) Show a statement which instantiates an object of this class using the overloaded constructor.
- You do not need to provide any accessor/mutator methods or other methods.
- (Points : 22)
- Question 2.2. (TCO 3) How does the “has-a” relationship relate to composition? Give an example of such a relationship. (Points : 18)
- Question 3.3. (TCO 4) Consider the class Employee. Given your knowledge of some common components of employees
- – show a class hierarchy in which the class Employee inherits from other classes, which, in turn, can also be inherited from yet other classes;
- – discuss inheritance from class Employee for other closely related derived classes; and
- – discuss the common components of class Employee. (Points : 18)
- Download: http://solutionzip.com/downloads/question-1-1-tco-1-which-of-the-following-would-be-the-most-appropriate-choice-for-a-method-in-a-book-class/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement