1. Which of the following would be the most appropriate choice for a method in a PhoneCharger class? (Points : 5)

A. Voltage()

B. Manufacturer()

C. Current()

D. Charge()

2. Object-oriented programming generally does not focus on _____. (Points : 5)

A. code reuse with classes

B. information hiding

C. ease of program modifiability

D. separating the interface from the implementation

E. All of the above

F. None of the above

G. Only A, C, and D

3. Which of the following components of a class definition do not have an access modifier? (Points : 5)

A. State variables

B. Data members

C. Member methods

D. Destructors

E. None of the above

4. Which of the following statements is/are true? (Points : 5)

A. A private (helper) method can only be used inside the class. It cannot be called through an object of the class.

B. The programmer can control the scope of a data member of a class using access specifiers.

C. The state of an object must be hidden and therefore protected by unauthorized use.

D. All of the above

E. Only A and C

5. Which of the following method pairs are not examples of method overloading? (Points : 5)

A. public void Bake() ; public int Bake(int x)

B. public int Mix(int x, int y) ; public int Mix(int y, int x)

C. public int Shake(int x, int y) ; public int Shake(int x, int y, int z)

D. None of the above

E. Only A and C

6. Which of the following statements is/are false? (Points : 5)

A. The method is the center of the object-oriented paradigm.

B. The class is a description of one or more entities with a uniform set of attributes (data members) and behaviors (member methods).

C. Abstraction is the process of ignoring the unimportant details about a category entity or activity, while concentrating on the high level information.

D. None of the above

7. Assume you implemented a class called Automobile last year. You made sure to design Automobile to include the concept of encapsulation. Now, you need to change the name of one of your private class attributes. Because you used the concept of encapsulation and followed best practices when designing your class, only the _____ and _____ need to be changed. (Points : 5)

A. getters; setters

B. access modifiers; constructors

C. data type; return values

D. public attributes; private methods

None of the above

8. A _____ is a term used to describe a system that can be understood solely based on its inputs, the resulting outputs and _____. (Points : 5)

A. class; a detailed understanding of its implementation

B. class; a basic understanding of its implementation

C. black box; a detailed understanding of its implementation

D. black box; a basic understanding of its implementation

9. Given a private attribute called hairColor, which of the following are proper pseudocode implementations for a getter and a setter? (Points : 5)

A. string getHairColor(){return hairColor}

int setHairColor(string newHairColor){return hairColor}

B. void getHairColor(){return hairColor}

void setHairColor (int newHairColor){hairColor = newHairColor}

C. string getHairColor(){return hairColor}

void setHairColor (string newHairColor){hairColor = newHairColor}

D. string getHairColor (){hairColor = newHairColor}

void setHairColor (string newHairColor){hairColor = newHairColor}

10. Which of the following statements is true? (Points : 5)

A. Interfaces must implement a default constructor if even one multi-arg constructor is also implemented.

B. Interfaces are defined and implemented inside an abstract class.

C. Methods listed in an interface must be implemented when used by another class.

C. At least one interface should be used in any inheritance hierarchy.

11. Abstract classes may contain which of the following? (Points : 5)

A. Abstract methods

B. Non-abstract methods

C. Virtual methods

D. A and B

E. A and C

F. B and C

G. A, B, and C

12. In terms of object-oriented programming, rules for the use of an application programming interface or framework can be enforced through the use of a(n) _____. (Points : 5)

A. contract

B. inheritance hierarchy

C. has-a relationship

D. object constructed with a multi-arg constructor

E. All of the above

13. If you have a complete, working Employee class that has been thoroughly tested, and you wish to add an overloaded getSalary() method that can calculate the salary of a Manager which is the total of salary and bonus, how should this be accomplished? (Points : 5)

A. Make a brand new class.

B. Add the method to your existing Employee class.

C. Add the method in the same class as the Main method.

D. Derive a new Manager class from the first Employee class and add it there.

14. An Order class and RushOrder class have what type of relationships? (Points : 5)

A. The Order has-a RushOrder.

B. The Order is-a RushOrder.

C. The RushOrder has-an Order.

D. The RushOrder is-an Order.

15. Which of the following is true about an inheritance hierarchy? (Points : 5)

A. It is not a good practice to have deeply layered inheritance hierarchies.

B. When an inheritance hierarchy is too deep, it is easy to lose track of the members in the great-grandchildren classes.

C. Inheritance hierarchies are easier to implement than to design.

D. All of the above

E. None of the above

16. 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)

A. Child, Parent, GrandParent

B. Parent, GrandParent, Child

C. GrandParent, Child, Parent

D. GrandParent, Parent, Child

17. What is polymorphism? (Points : 5)

A. An advanced form of inheritance

B. A single usefulness for program specificity

C. One interface may be associated with many implementations

D. Data hiding

18. Which of the following is not a good example of a hierarchy that could be modeled with inheritance? (Points : 5)

A. Airplanes

B. Geometric shapes

C. Animals

D. Prime numbers

19. Data/information hiding and encapsulation improves construction and maintenance because: (Points : 5)

A. Adding additional details is isolated to a single class.

B. Program bugs are isolated to a single class.

C. Programming to an interface makes the code more logical.

D. All of the above

E. None of the above

20. What are some of the characteristics of “self-documenting” code? (Points : 5)

A. Logical identifier names

B. Value-adding comments

C. Straightforward algorithms

D. All of the above

E. None of the above

21. Which of the following allow a programmer to reduce the complexity of an object-oriented program? (Points : 5)

A. Create each class in a separate file

B. Combine multiple classes in a same file to allow easy access

C. Using one file to combine all the code to allow easy access

D. None of the above

22. Which of the following is a proper implementation for a setter? (Points : 5)

A. int SetNumberOfLegs() { return legs;}

B. void SetNumberOfLegs (int legs) {this.legs = legs;}

C. void SetNumberOfLegs (int legs) {return legs;}

D. void SetNumberOfLegs () {return legs;}

23. Which of the following declares an abstract method in an abstract class? (Points : 5)

A. public abstract CalculateTip();

B. public abstract double CalculateTip();

C. public double abstract CalculateTip();

D. public double CalculateTip() {}

24. Assuming a class definition of a Pet 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)

{

Pet newObject;

Pet newPet = new Pet();

Pet myPet = new Pet("Cat", "Lucy", "Persian");

newObject = newPet;

newObject.PetName = myPet.PetName;

} (Points : 5)

A.  1

B.  2

C.  3

D.  4