SSL Certificate
  • Which of the following components of a class definition have a return type


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 have a return type? (Points : 5)
 Constructors
 Destructors
 Overloaded constructors
 All of the above
 None of the above



3. (TCO 5) Which of the following method pairs are examples of method overloading? (Points : 5)
 A. public int 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)
 All of the above
 Only B and C



4. (TCO 1) Which of the following statements is/are true? (Points : 5)
 Abstraction is the process of ignoring the unimportant details about a category entity or activity, while concentrating on the high level information.
 Abstraction is the basic concept of the object-oriented paradigm.
 Objects are created during program execution and eventually destroyed.
 All of the above



5. (TCO 1) Which of the following would be the most appropriate choice for a method in a Cup class? (Points : 5)
 Drink()
 Hot()
 Break()
 Color()



6. (TCO 2) Which of the following statements is/are true? (Points : 5)
 A. The state of an object must be public, for easier modification.
 B. A static method of a class can access non-static members of the class directly.
 C. A constructor is automatically created for you if you do not define one.
 None of the above
 Only B and C




7. (TCO 4) Which of the following design rules apply to inheritance? (Points : 5)
 Common functionality needs to be pushed to the parent class.
 Inheritance demonstrates the generalization/specialization relationship
 A child class can itself be a parent class
 All of the above



8. (TCO 4) There are two classes: class GeometricObject and class Cylinder. Which one is the base class and which one is the derived class? (Points : 5)
 classGeometricObject is the derived class from Cylinder.
 They have nothing in common and therefore have no relationships.
 class Cylinder is the base class.
 class Cylinder is derived from GeometricObject.



9. (TCO3) Which of the following is true about identifying a class based on a set of requirements? (Points : 5)
 After the requirements are documented, the process of identifying classes can begin.
 One way to identify classes is to identify nouns in the problem analysis.
 Responsibilities of each class need to be identified after classes are identified.
 All of the above



10. (TCO3) What happens right after the identification of classes in the object oriented design process? (Points : 5)
 Determining the class responsibilities
 Determining class interaction
 Creating UML diagram
 Developing SOW



11. (TCO 4) In what type(s) of situation(s) would it be best to make a new derived class from a base class? (Points : 5)
 A. When your old class is a general form of what your new class should be
 B. When you need to create a specialized class from an existing class
 A and B
 None of the above



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



13. (TCO 2) You need to utilize a Plant class in your own object-oriented class using composition. Luckily, one of your fellow students just finished writing their own version of a Plant class. If the Plant class was properly designed as a black box, which of the following statements is false? (Points : 5)
 All of the required inputs will be revealed to you.
 All of the outputs will be revealed to you.
 Only the implementation details will be revealed to you.
 Only the interface details will be revealed to you.



14. (TCO 2) A class is designed with three public attributes: attributeOne, attributeTwo and attributeThree. attributeOne is an integer data type, attributeTwo is a double data type and attributeThree is a string data type. Which pseudocode representation(s) of getters would be appropriate for this class? (Points : 5)
 A. intGetAttributeOne()
{
return attributeOne
}
 B. string GetAttributeTwo()
{
return attributeTwo
}
 C. intGetAttributeThree(intnewAttributeThree)
{
attributeThree = newAttributeThree
}
 D. void GetAttributeTwo()
{
return attributeOne
}
 Both A and D
 None of the above



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





1. (TCO 7) Which of the following statements are true? (Points : 5)
 Interfaces are written across multiple files, unlike classes.
 The name of an interface often begins with a lowercase “I” in C#.
 Interfaces can be used to implement a form of triple inheritance.
 Interfaces are not instantiated like a concrete class.



2. (TCO 7) Which of the following statements is/are true? (Points : 5)
 Interfaces contain both regular and abstract methods
 Abstract classes always provide implementations for all of their methods
 Abstract methods can be inherited by subclasses
 None of the above



3. (TCO 7) In terms of object-oriented programming, abstract classes and interfaces enforce a(n) ______ which is simply a mechanism that forces programmers to adhere to certain “rules.” (Points : 5)
 contract
 hierarchy
 compromise
 method signature
 None of the above



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



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



6. (TCO 9) The purpose of a namespace is to: (Points : 5)
 organize your code
 give you a way to create global types
 provide a container for logically related items
 All of the above
 None of the above



7. (TCO 1) Assuming a class definition of a Fish 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)
{
Fish newFishObject;
Fish newFish = new Fish("Fish", "Leila", "Goldfish");


newFishObject = newFish;
newFish = newFishObject;
}
(Points : 5)



 1
 2
 3
 4



8. (TCO 2) Which of the following is a proper implementation for a getter? (Points : 5)
 intGetDayOfBirth() { return day;}
 void GetDayOfBirth() {return day;}
 intGetDayOfBirth (int day) {this.day = day;}
 void GetDayOfBirth () {return day;}



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



10. (TCO 8) Briefly describe best practices as it relates to naming variables and their associated accessor/mutator properties. (Points : 18)
 


11. (TCO 2) Sometimes the terms Encapsulation and Data/Information Hiding in object-oriented programming are used interchangeably. Is it correct to use the terms interchangeably? Why or why not? (Points : 18)
 
12. (TCO 4) What is inheritance and what are the major benefits of using inheritance? What programming technique shall you follow when the base class methods are not appropriate for the derived class object? (Points : 18)


 
13. (TCO 6) How does polymorphism promote extensibility? How does polymorphism enable you to program “in the general” rather than “in the specific.” Explain the key advantages of programming “in the general.” (Points : 18)
 





14. (TCO 2) Given the following list of classes, attributes and methods,


- identify which items are classes, which items are attributes and which items are methods;


- suggest a class hierarchy given your list of classes.
Class Rose inherits class plant


*Note – no particular capitalization scheme is used in the list below to differentiate between classes, methods and attributes.


AdhereToBuilding, NumberOfPetals, Photosynthesize, EmitFragrance, Length, Plant, Height, DaysToGermination, Rose, Grow, LosePetals, ConsumeWater, FloweringSeason, Vine, Color, LeavesPerInch(Points : 18)




15. (TCO 2) Briefly describe what an Interface is and how it can be used in an object-oriented program. Provide example pseudocode showing how an IComputer Interface might be constructed. (Points : 18)


1. (TCO 2) Keeping in mind all object-oriented programming best practices, create a class for a Cabinet, with the following specifications:
• Specify two data members
• Default Constructor
• Overloaded Constructor which takes both data member values as input.
• 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.
• 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)


Write a review

Please login or register to review

Which of the following components of a class definition have a return type

  • $9.99


*All your data are SECURED & ENCRYPTED using a valid, trusted server certificate (Comodo SSL) and we don't store credit card information on our servers and all Payments are SECURED & handled by Paypal.
SSL CertificatePaypal

Tags: Multiple choice question, MCQ, java, object oriented programming, oop