Object-Oriented Programming Concepts and Applications

An assignment explaining object-oriented programming principles with practical applications.

Ethan Wilson
Contributor
4.4
44
5 months ago
Preview (4 of 11 Pages)
100%
Purchase to unlock

Page 1

Object-Oriented Programming Concepts and Applications - Page 1 preview image

Loading page image...

Object-Oriented Programming Concepts and ApplicationsQuestion 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 thegoal when designing a class.D. An interface of a class defines what messages an object can respond to.All are trueNone are trueOnly A and D are trueQuestion 2.2. (TCO 2) Which of the following components of a class definition can be overloaded? (Points: 5)Any objectConstructorStatic data membersAll of the aboveNone of the aboveQuestion 3.3. (TCO 5) Which of the following method pairs are not examples of method overloading?(Points : 5)public void dance()public int dance(int x)public int walk(int x, int y)public void walk(int x, int y, int z)public int jump(int x, int y)public void jump(int y, int x)All of the aboveNone of the aboveQuestion 4.4. (TCO 1) Which of the following statements is/are true? (Points : 5)You can create sub-classes and sub-objects.By using the keyword class in your program, memory is allocated for the object being defined.In object-oriented programming we design the program as a set of cooperating methods.None of the aboveQuestion 5.5. (TCO 1) Which of the following would be the most appropriate choice for a method in aComputer class? (Points : 5)monitorSizerebootprocessorTypekeyboard

Page 2

Object-Oriented Programming Concepts and Applications - Page 2 preview image

Loading page image...

Page 3

Object-Oriented Programming Concepts and Applications - Page 3 preview image

Loading page image...

Question 6.6. (TCO 2) Which of the following statements is/are true? (Points : 5)A. The compiler generated default constructor does the exact same job as any user defined defaultconstructorB. A common use of information hiding is to hide the physical storage layout of data.C. A private (helper) method is part of a class's implementation.All of the aboveOnly B and CQuestion 7.7. (TCO 2) You are given a Shape class that was designed with the concept of a black box inmind. You need to integrate the Shape class into your own code. Which of the following statements aretrue? (Points : 5)You need to analyze each method's implementation that you plan to use in order to understand itthoroughly.You need to figure out the inputs and outputs that are associated with the class.You may have to modify the internal processing to meet the needs of your specific class.Without a properly constructed UML diagram you cannot be sure how the new class will integratewith your code.Question 8.8. (TCO 2) Given a private string attribute called homeState, which of the following are properpseudocode implementations for a getter and a setter? (Points : 5)string getHomeState(){return homeState }int setHomeState(string newHomeState){return homeState }void getHomeState(){return homeState }void setHomeState (int newHomeState){homeState = newHomeState}string getHomeState(){return homeState }void setHomeState (string newHomeState){ homeState = newHomeState}string getHomeState (){homeState = newHomeState}void setHomeState (string newHomeState){ homeState = newHomeState}Question 9.9. (TCO 2) You are tasked to create an EntertainmentSystem class and you want to minimizedata dependencies. You also need to protect specific attributes from outside entities. What object-oriented concept(s) would you use to accomplish these goals? (Points : 5)Composition of classesUniversal access to methodsInheritanceEncapsulationAll of the aboveQuestion 10.10. (TCO 4) Select the false statement regarding inheritance.(Points : 5)A child class can have more functionality than parent class.A child class can itself be parent class.Common functionality needs to be designed in the parent class.Parent classes are usually more specific than child classes.

Page 4

Object-Oriented Programming Concepts and Applications - Page 4 preview image

Loading page image...

Question 11.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 LampThe LightBulb has an OilLamp, and the Lamp is an OilLamp.Question 12.12. (TCO 3) Which of the following is true about identifying a class based on a set ofrequirements?(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 aboveQuestion 1.1. (TCO 3) What does SOW stand for in the object-oriented design process?(Points : 5)Sequence of workStructure of workStatement of workNone of the aboveQuestion 2.2. (TCO 4) What are the benefits to create another derived class instead of adding newfunctionalities to the program?(Points : 5)Saves time on debugging the programSimplifies testingNo need to re-test the previously written classAll of the aboveNone of the aboveQuestion 3.3. (TCO 6) What is polymorphism?(Points : 5)An advanced form of inheritanceA single usefulness for program specificityOne interface, many implementationsData hidingQuestion 4.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.
Preview Mode

This document has 11 pages. Sign in to access the full document!

Study Now!

XY-Copilot AI
Unlimited Access
Secure Payment
Instant Access
24/7 Support
Document Chat

Document Details

Related Documents

View all