(TCO 1) Which of the following would be the most appropriate choice for a method
ID: 3693229 • Letter: #
Question
(TCO 1) Which of the following would be the most appropriate choice for a method in a Book class? (Points : 5)
Author()
NumberChapters()
Publish()
Language()
2.2. (TCO 1) 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
All of the above None of the above
Only A, C, and D
3.3. (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
4.4. (TCO 2) Which of the following statements is/are true? (Points : 5)
A. In general, reusable classes tend to have interfaces that are more abstract than concrete.
B. The compiler generated default constructor does the exact same job as any user defined default constructor.
C. A private (helper) method is part of a class’s interface.
None of the above
Only A and B
5.5. (TCO 5) Which of the following method pairs are examples of method overloading? (Points : 5)
A. public void Bake() ; public int Bake(int x)
B. public int Mix(int x, int y, int z) ; public int Mix(int y, int x, int z)
C. public int Shake(int x, int y) ; public int Shake(int x, int y, int z)
All of the above Only A and C
6.6. (TCO 1) Which of the following statements is/are false? (Points : 5)
The method is the center of the object-oriented paradigm.
The class is a description of one or more entities with a uniform set of attributes (data members) and behaviors (member methods).
Abstraction is the process of ignoring the unimportant details about a category entity or activity, while concentrating on the high level information.
None of the above Question
7.7. (TCO 2) You need to design an Automobile class. How can you utilize the concept of encapsulation to design this class? (Points : 5)
Subdivide the two most general attributes of any Automobile, make and model, into more specific attributes.
Create a Make class and a Model class and integrate them into Automobile using composition.
Include both general attributes such as make and model with generic behaviors such as consumeFuel and moveForward into one entity.
Find a Transportation class and inherit only those pieces that you need from it.
All of the above
8.8. (TCO 2) A _____ is a term used to describe a system that can be understood solely based on its inputs, the resulting outputs and _____. (Points : 5)
class; a detailed understanding of its implementation
class; a basic understanding of its implementation
black box; a detailed understanding of its implementation
black box; a basic understanding of its implementation
9.9. (TCO 2) Given a private attribute called age, which of the following are proper implementations for a getter and a setter? (Points : 5)
void getAge(){return age} void setAge(int newAge){age = newAge}
int getAge(){return age} int setAge(int newAge){return newAge}
int getAge(){age = newAge} void setAge(int newAge){return age} int getAge(){return age}
void setAge(int newAge){age = newAge}
10.10. (TCO 7) Which of the following statements is true? (Points : 5)
Interfaces must implement a default constructor if even one multi-arg constructor is also implemented.
Interfaces are defined and implemented inside an abstract class.
Methods listed in an interface must be implemented when used by another class.
At least one interface should be used in any inheritance hierarchy.
11.11. (TCO 7) Which of the following statements is/are false? (Points : 5)
Abstract methods may or may not contain instance variables.
Abstract methods may be defined in an abstract class, a regular class or an interface.
Abstract methods do not specify a return type.
All of the above
None of the above Question 1
2.12. (TCO 7) _____ and _____ enforce a(n) _____ which is a methodology used in object-oriented programming to force programmers to adhere to certain “rules.” (Points : 5)
Abstract classes; interfaces; contract
Static variables; methods; hierarchy
Classes; objects; transitive communication
Method signatures; the static keyword; encapsulation
None of the above
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)
Add the method to your existing Circle class.
Derive a new class Cylinder from the Circle class.
Make a brand new class.
Add the method in the same class as the Main method.
14.14. (TCO 3) A Ball class and a Baseball class have what type of relationship? (Points : 5)
The Ball is-a Baseball.
The Baseball is-a Ball.
The Ball has-a Baseball
The Baseball has-a Ball.
15.15. (TCO 4) Which of the following is true about an inheritance hierarchy? (Points : 5)
It is not a good practice to have deeply layered inheritance hierarchies.
When an inheritance hierarchy is too deep, it is easy to lose track of the members in the great-grandchildren classes.
Inheritance hierarchies are easier to implement than to design.
All of the above
None of the above
Explanation / Answer
1)
Therefore the correct option is “Author(), NumberChapters(), Publish(),Language()”.
2)
Therefore the correct option is “All of the above”.
3)
Therefore the correct option is “Constructors”.
4)
Therefore the correct answer is “None of the above”.
5)
Therefore the correct option is “Only A and C”.
6)
Therefore the correct option is “Abstraction is the process of ignoring the unimportant details about a category entity or activity, while concentrating on the high level information.”.
7)
Therefore the correct option is “Include both general attributes such as make and model with generic behaviors such as consumeFuel and moveForward into one entity.”.
8)
Therefore the correct option is “black box; a basic understanding of its implementation”.
9)
Therefore the correct option is “int getAge(){return age}void setAge(int newAge){age = newAge}”
10)
Therefore the correct option is “Methods listed in an interface must be implemented when used by another class.”.
11)
The correct option is “All of the above”
12)
The correct option is “Static variables; methods; hierarchy”.
13)
The correct option is “Add the method to your existing Circle class.”.
14)
The correct option is “The Baseball is-a Ball. ”.
15)
The correct option is “All of the above”.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.