Advertisement
akosiraff

Download Question 1.1. (TCO 1) Which of the following would

Aug 28th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.89 KB | None | 0 0
  1.  
  2. 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/
  3. Question 1.1. (TCO 1) Which of the following would be the most appropriate choice for a method in a Book class? (Points : 5)
  4. Author()
  5. NumberChapters()
  6. Publish()
  7. Language()
  8. Question 2.2. (TCO 1) Object-oriented programming generally focuses on _____. (Points : 5)
  9. A. separating the interface from the implementation
  10. B. client side access to implementation details
  11. C. creating as many classes as possible
  12. D. code reuse with classes
  13. All of the above
  14. None of the above
  15. Only A and D
  16. Question 3.3. (TCO 2) Which of the following components of a class definition cannot be overloaded? (Points : 5)
  17. Public member methods
  18. Destructors
  19. Constructors
  20. Private member methods
  21. All of the above
  22. Question 4.4. (TCO 2) Which of the following statements is/are true? (Points : 5)
  23. A. A default constructor is automatically created for you if you do not define one.
  24. B. A static method of a class can access non-static members of the class directly.
  25. C. An important consideration when designing a class is identifying the audience, or users, of the class.
  26. None of the above
  27. Only A and C
  28. Question 5.5. (TCO 5) Which of the following method pairs are examples of method overloading? (Points : 5)
  29. A. public void Bake() ; public int Bake(int x)
  30. B. public int Mix(int x, int y, int z) ; public int Mix(int y, int x, int z)
  31. C. public int Shake(int x, int y) ; public int Shake(int x, int y, int z)
  32. All of the above
  33. Only A and C
  34. Question 6.6. (TCO 1) Which of the following statements is/are false? (Points : 5)
  35. Abstraction is the process of ignoring the high level information about a category entity or activity, while concentrating on the “unimportant” details.
  36. The object oriented paradigm permits the modeling of a software system in a more natural way compared to the procedural paradigm.
  37. In object-oriented programming we design the program as a set of cooperating objects.
  38. None of the above
  39. 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)
  40. Declare as many class attributes public as you can, creating accessor/mutators for each one.
  41. Package attributes and behaviors specific to an Automobile together.
  42. Make sure to include a specific implementation for a drive method that all subclasses can inherit.
  43. Declare the class as private.
  44. All of the above
  45. 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)
  46. interfaces; the detailed implementations
  47. inputs; outputs
  48. private methods; accessors
  49. relationships; UML diagrams
  50. 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)
  51. A. int setAttributeOne(int newAttributeOne)
  52. {
  53. return attributeOne
  54. }
  55. B. void setAttributeOne(int newAttributeOne)
  56. {
  57. attributeOne = newAttributeOne
  58. }
  59. C. string setAttributeTwo (int newAttributeTwo)
  60. {
  61. attributeTwo = newAttributeTwo
  62. }
  63. D. void setAttributeTwo ()
  64. {
  65. attributeTwo = “ “
  66. }
  67. Both A and C
  68. None of the above
  69. Question 10.10. (TCO 7) Which of the following statements is true? (Points : 5)
  70. Interfaces must implement a default constructor if even one multi-arg constructor is also implemented.
  71. Interfaces are defined and implemented inside an abstract class.
  72. Methods listed in an interface must be implemented when used by another class.
  73. At least one interface should be used in any inheritance hierarchy.
  74. Question 11.11. (TCO 7) In an object-oriented program, a(n) _____ might be found in a(n) _____ and/or a(n) _____. (Points : 5)
  75. object; attribute; base class
  76. method with no implementation; abstract class; interface
  77. interface; base class; abstract class
  78. None of the above
  79. 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)
  80. abstract classes; constants
  81. abstract classes; interfaces
  82. base classes; abstract methods
  83. has-a; is-a relationships
  84. None of the above
  85. 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)
  86. Add the method to your existing Circle class.
  87. Derive a new class Cylinder from the Circle class.
  88. Make a brand new class.
  89. Add the method in the same class as the Main method.
  90. Question 14.14. (TCO 3) An Order class and RushOrder class have what type of relationships? (Points : 5)
  91. The Order has-a RushOrder.
  92. The Order is-a RushOrder.
  93. The RushOrder has-an Order.
  94. The RushOrder is-an Order.
  95. Question 15.15. (TCO 4) Which of the following is true about an inheritance hierarchy? (Points : 5)
  96. It is not a good practice to have deeply layered inheritance hierarchies.
  97. When an inheritance hierarchy is too deep, it is easy to lose track of the members in the great-grandchildren classes.
  98. Inheritance hierarchies are easier to implement than to design.
  99. All of the above
  100. 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)
  101. Child, Parent, GrandParent
  102. Parent, GrandParent, Child
  103. GrandParent, Child, Parent
  104. GrandParent, Parent, Child
  105. 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)
  106. Information hiding
  107. Inheritance
  108. Redefinition
  109. Overloading
  110. 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)
  111. Airplanes
  112. Geometric shapes
  113. Animals
  114. Prime numbers
  115. Question 4.4. (TCO 8) Data/information hiding and encapsulation improves construction and maintenance because: (Points : 5)
  116. Adding additional details is isolated to a single class.
  117. Program bugs are isolated to a single class.
  118. Programming to an interface makes the code more logical.
  119. All of the above
  120. None of the above
  121. Question 5.5. (TCO 8) What are some of the characteristics of “self-documenting” code? (Points : 5)
  122. Logical identifier names
  123. Value-adding comments
  124. Straightforward algorithms
  125. All of the above
  126. None of the above
  127. Question 6.6. (TCO 9) Which of the following allow a programmer to reduce the complexity of an object-oriented program? (Points : 5)
  128. Creating each class in a separate file
  129. Using namespaces as a container for logically related items
  130. Using namespaces to create global types
  131. All of the above
  132. None of the above
  133. Question 7.7. (TCO 2) Which of the following is a proper implementation for a setter? (Points : 5)
  134. int SetNumberOfLegs() { return legs;}
  135. void SetNumberOfLegs (int legs) {this.legs = legs;}
  136. void SetNumberOfLegs (int legs) {return legs;}
  137. void SetNumberOfLegs () {return legs;}
  138. Question 8.8. (TCO 7) Which of the following declares an abstract method in an abstract class? (Points : 5)
  139. public abstract CalculateTip();
  140. public abstract double CalculateTip();
  141. public double abstract CalculateTip();
  142. public double CalculateTip() {}
  143. 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?
  144. static void Main(string[] args)
  145. {
  146. Dog newObject;
  147. Dog newDogObject = new Dog();
  148. Dog newDog = new Dog(“Dog”, “Jack”, “Labrador”);
  149. Dog newDoggie = new Dog(); ;
  150. newObject = newDogObject;
  151. newDoggie = newDog;
  152. }
  153. }
  154. (Points : 5)
  155. 2
  156. 6
  157. 3
  158. 4
  159. 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)
  160. Question 11.11. (TCO 2) Does Encapsulation imply Data/Information Hiding in object-oriented programming? Why or why not? (Points : 18)
  161. Question 12.12. (TCO 2) Given the following program description,
  162. – identify the required classes/objects necessary to achieve the program requirements;
  163. – briefly describe any relationships that might exist between your classes; and
  164. – briefly describe the overall hierarchy of your proposed classes.
  165. 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)
  166. 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)
  167. Question 1.1. (TCO 2) Keeping in mind all object-oriented programming best practices, create a class for a Computer, with the following specifications:
  168. 1) Specify two data members
  169. 2) Default Constructor
  170. 3) Overloaded Constructor which takes both data member values as input.
  171. 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.
  172. 5) Show a statement which instantiates an object of this class using the overloaded constructor.
  173. You do not need to provide any accessor/mutator methods or other methods.
  174. (Points : 22)
  175. Question 2.2. (TCO 3) How does the “has-a” relationship relate to composition? Give an example of such a relationship. (Points : 18)
  176. Question 3.3. (TCO 4) Consider the class Employee. Given your knowledge of some common components of employees
  177. – show a class hierarchy in which the class Employee inherits from other classes, which, in turn, can also be inherited from yet other classes;
  178. – discuss inheritance from class Employee for other closely related derived classes; and
  179. – discuss the common components of class Employee. (Points : 18)
  180.  
  181.  
  182. 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