1. (TCO 1) Which of the following would be the most appropriate choice for a met
ID: 3555346 • Letter: 1
Question
1. (TCO 1) Which of the following would be the most appropriate choice for a method in a DrinkingStraw class? (Points : 5) color
bend
eat
material
A constructor is automatically created for you if you do not define one.
A static method of a class can access all attributes of the class directly.
The most important consideration when designing a class is identifying the audience, or users, of the class.
None of the above
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); public int mix(int y, int x)
C. public int shake(int x, int y); public int shake(int x, int y, int z)
All of the above
Only A and B
Only A and C
9. (TCO 2) Given a private string attribute called hairColor, which of the following are proper pseudocode implementations for a getter and a setter? (Points : 5) string getHairColor(){return hairColor}
int setHairColor(string newHairColor){return hairColor}
void getHairColor(){return hairColor}
void setHairColor (int newHairColor){hairColor = newHairColor}
string getHairColor(){return hairColor}
void setHairColor (string newHairColor){hairColor = newHairColor}
string getHairColor (){hairColor = newHairColor}
void setHairColor (string newHairColor){hairColor = newHairColor}
When your current class is a general form of what your new class should be
When you need to create a specialized class from an existing class
When your base class is abstract
All of the above
None of the above
B. client side access to implementation details.
C. information hiding.
D. ease of program modifiability.
All of the above
None of the above
Only A, C, and D
Explanation / Answer
1. bend
2. All of the above
3. A, B, and C only
4.true false true
5. All of the above
6. All of the above
7. All of the above
8. inherited processes
9.string getHairColor(){return hairColor} and void setHairColor (string newHairColor){hairColor = newHairColor}
10. Add the method to your existing Employee class
11. The Baseball is-a Ball.
12.All of the above
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.