Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

ID: 3538299 • Letter: P

Question

Page 1

1. (TCO 1) Which of the following statements is/are true? (Points : 5)       A. The implementation of a class should be hidden, as best practice.
      B. The state of an object is defined as the attributes and behaviors of that object.
      C. Striving for the fullest possible interface of a class, incorporating possible future class needs, is the goal when designing a class.
      D. An interface of a class defines what messages an object can respond to.
      All are true
      None are true
      Only A and D are true

2. (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


3. (TCO 5) Which of the following method pairs are examples of method overloading? (Points : 5)       A.     public void jump(int x)
public int jump(int y)
      B.     public int walk(int x, int y)
public void walk(int x, int y, int z)
      C.     public void dance()
public int dance(int x)
      Only A and B
      Only B and C

4. (TCO 1) Which of the following statements is/are true? (Points : 5)       The method is the center of the object-oriented paradigm.
      The procedural paradigm permits the modeling of a software system in a more natural way compared to the object-oriented paradigm.
      Abstraction is the process of ignoring the high level information about a category entity or activity, while concentrating on the "unimportant" details.
      None of the above

5. (TCO 1) Which of the following would be the most appropriate choice for a method in a Cube class? (Points : 5)       volume
      area
      radius
      calculateDiameter

6. (TCO 2) Which of the following statements is/are true? (Points : 5)       A. A private (helper) method can only be used inside the class where it is defined.
      B. The programmer can control the scope of a data member of a class using access specifiers.
      C. Getters and setters allow access to private attributes.
      All of the above
      Only A and C

7. (TCO 2) A black box is a term used to describe a system that can be understood solely based on its inputs, a description of its processing and the resulting _____. (Points : 5)       outputs
      inherited processes
      attributes
      accessors

8. (TCO 2) Given a private attribute called species, which of the following are proper pseudocode implementations for a getter and a setter? (Points : 5)       void getSpecies(){return species}
void setSpecies(string newSpecies){ species = newSpecies }
      string getSpecies (){return species }
string setSpecies (string newSpecies){return newSpecies }
      string getSpecies (){species = newSpecies }
void setSpecies (string newSpecies){return species }
      string getSpecies (){return species }
void setSpecies (string newSpecies){ species = newSpecies}

9. (TCO 2) You have been tasked to create an EntertainmentSystem 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 a single no-arg constructor in order to prevent outside entities from initializing the state of a new EntertainmentSystem object.
      Combine attributes and behaviors specific to an EntertainmentSystem together into one cohesive unit.
      Declare the class as static so that only one instance of an EntertainmentSystem can be used at a time.
      Declare the class as private.
      All of the above

10. (TCO 4) Which of the following is true about inheritance?
(Points : 5)       Child classes are more generalized than their associated parent classes.
      Parent classes are more specialized than their associated child classes.
      Parent classes contain more functionality than child classes.
      Inheritance demonstrates the generalization/specialization relationship.


11. (TCO 4) A Lamp class, LightBulb and OilLamp class have what type of relationships?
(Points : 5)       The Lamp is a LightBulb, and the Lamp is an OilLamp.
      The LightBulb has an OilLamp, and the OilLamp is a Lamp.
      The Lamp has a LightBulb, and the OilLamp is a Lamp
      The LightBulb has an OilLamp, and the Lamp is an OilLamp.


12. (TCO 3) Which of the following might be potential class(es) in an application?
(Points : 5)       Address
      Item
      Credit
      All of the above
      None of the above

Page 2

1. (TCO 3) What does SOW stand for in the object-oriented design process?
(Points : 5)       Sequence of work
      Structure of work
      Statement of work
      None of the above


2. (TCO 4) What are the benefits to create another derived class instead of adding new functionalities to the program?
(Points : 5)       Saves time on debugging the program
      Simplifies testing
      No need to re-test the previously written class
      All of the above
      None of the above


3. (TCO 6) What is polymorphism?
(Points : 5)       An advanced form of inheritance
      A single usefulness for program specificity
      One interface, many implementations
      Data hiding

4. (TCO 7) Which of the following statements are false? (Points : 5)       Interfaces specify a contract that must be respected by programmers implementing the interface.
      Interfaces specify one or more method signatures and at least one implementation.
      Interfaces can be used in some object-oriented languages to implement a form of multiple inheritance.
      Interfaces are often implemented by regular classes.

5. (TCO 7) Which of the following statements are true? (Points : 5)       A. Abstract classes may contain abstract methods
      B. Non-abstract classes may contain abstract methods
      C. Interfaces contain abstract methods
      A and B
      A and C
      B and C

      A, B, and C

6. (TCO 7) An object-oriented program may use _____ and _____ to force programmers to adhere to a contract or a specification defined by a framework.(Points : 5)       base classes; abstract methods
      abstract classes; interfaces
      has-a; is-a relationships
      abstract classes; constants
      None of the above

7. (TCO 8) Data/information hiding and encapsulation improves construction and maintenance because:
(Points : 5)       Program bugs are isolated to a single class.
      Coupling is increased.
      Programming to an interface makes the code and design difficult.
      All of the above
      None of the above


8. (TCO 8) What are some of the characteristics of "self-documenting" code?
(Points : 5)       Detailed comments, addressing all aspects of the code
      Deep levels of nesting to ensure all situations are addressed
      Straightforward algorithms
      All of the above
      None of the above


9. (TCO 9) Which of the following allow a programmer to reduce the complexity of an object-oriented program.
(Points : 5)       Create each class in a separate file
      Combine multiple classes in a same file to allow easy access
      Using one file to combine all the code to allow easy access
      None of the above


10. (TCO 7) Which of the following declares an abstract method in an abstract Java class? (Points : 5)       public abstract void cookIngredients() {}
      public void cookIngredients() {}
      public abstract void cookIngredients();
      public abstract cookIngredients();

11. (TCO 4) Given the following classes, ClassB and Class D, what line of code in the overridden version of greatMethod found in ClassD will invoke the version of greatMethod located in Class B?

public class ClassB {

            void greatMethod(){       
                        System.out.println("ClassB greatMethod");
            }
}


public class ClassD extends ClassB {

            public void greatMethod(){

                        // What line of code goes here to invoke ClassB's greatMethod?

                        System.out.println("ClassD overrides greatMethod");
            }
} (Points : 5)       super().greatMethod();
      super.greatMethod();
      ClassB.greatMethod();
      ClassD.greatMethod();
      None of the above

12. (TCO 7) Which of the following is a proper declaration of an abstract method? (Points : 5)       public abstract eat();
      public abstract void eat();
      public void eat();
      public void abstract eat();
      All of the above
      None of the above

Explanation / Answer

1.c

2.d

3.c3.a

4.b

5.d

6.c

7.b

8.a

9.c

10.d

11.d

12.b



1.d

2.a

3.c

4.d

5.b

6.c

7.a

8.d

9.c

10.a

11.d

12.c