Description
Devry CIS 247 Week 2 Quiz Latest
- 1.Question : (TCO 2) Only those class members which are part of the interface of the class should be declared as _____.
open
banned
private
public
Question 2. Question : (TCO 2) A public accessor is usually paired with a public _____ to allow an outside class to set and retrieve the value of an object’s attribute.
constructor
mutator
getter
None of the above
Question 3. Question : (TCO 2) Which of the following statements is/are true?
If a method is public, it is considered part of the class implementation.
If you declare an attribute as private, you do not have to worry about tracking down every piece of code that might have changed the attribute when debugging.
While designing a class you add as many interfaces as possible, trying to cover all possible future user needs.
All of the above
None of the above
Question 4. Question : (TCO 2) A Waiter is responsible for taking the order from the Customer based on the menu, informing the Chef of the order, and delivering the requested food back to the Customer. A Chef is responsible for preparing the food, while the Customer is responsible for placing an order from the menu. In identifying the interface of the Waiter object, which of the following would you consider as (an) appropriate message(s) the Waiter should respond to:
- A.“Please bring me chicken soup”
- B.“Can you tell me how to make macaroni and cheese?”
- C.“How many hours do you work?”
All of the above
Only A and B
Question 5. Question : (TCO 5) The purpose of a(n) _____ is to initialize the object’s data members when an object is instantiated.
method
constructor
class
destructor
Question 6. Question : (TCO 5) Which of the following method pairs are not examples of method overloading?
- A.public void roll() ; public int move(int x)
- B.public int charge(int x) ; public int charge(int y)
- C.public int subtract() ; public void subtract()
All of the above
Only B
Question 7. Question : (TCO 5) Consider the following class definition.
public class Rose
{
private int petals;
private double cost;
public Rose()
{
petals = 30;
cost = 0.0;
}
public Rose(int p)
{
petals = p;
cost = 0.0;
}
public int getPetals()
{
return petals;
}
public void setCost(int amount)
{
cost = amount;
}
}
Which of the following are true?
(i) The attribute cost can be set to a new value, by a user of this class.
(ii) System.out.println (“The rose has: ” Rose.getPetals()); is a valid statement.
(iii) There are overloaded constructors in the class.
i.
ii
Only i and iii
None are true
All are true
Question 8. Question : (TCO 2) Assume a class has a data member called ‘color’. Can another class have a data member called ‘color’?
Yes, as long as the data member is used in the same way.
No, this is not possible because the compiler would not know which data member to use.
Yes, but only if the classes are not in the same namespace.
None of the above
Question 9. Question : (TCO 5) Which error handling technique is the least appropriate when developing an application?
Check for potential problems and abort the application when a problem is encountered.
Check for potential problems and throw an exception.
Check for potential problems, catch the mistake and try to fix it.
Ignore the problem; all applications crash at some point.
Question 10. Question : (TCO 2) Which is an appropriate choice for a static (or otherwise called class) attribute in a Building class?
numberOfBuildings
numberOfApartments
numberOfFloors
None of the above
DeVry Courses helps in providing the best essay writing service. If you need 100% original papers for Devry CIS 247 Week 2 Quiz Latest, then contact us through call or live chat.
Devry CIS 247 Week 2 Quiz Latest

Reviews
There are no reviews yet.