Devry CIS247 Week 2 Quiz Latest 2016 Jan.
Devry CIS247 Week 2 Quiz Latest 2016 Jan.
1. Question : (TCO 2) Only those class members which are presented to the users of the class are part of the _____ of the class.
interface
implementation
constructors
superclass
Question 2. Question : (TCO 2) Getters and setters are sometimes called _____ methods and _____ methods, respectively.
mutator; accessor
accessor; mutator
retrieval; putter
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 and notifying the Waiter when the food is ready. 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?
“Please bring me chicken soup.”
“Can you tell me how to make macaroni and cheese?”
“How many hours do you work?”
All of the above
Only A and B
Question 5. Question : (TCO 5) One of the purposes of a(n) _____ is to release resources back to the system when the object is not used anymore.
class
constructor
destructor
instance variable
Question 6. Question : (TCO 5) Which of the following method pairs are not examples of method overloading?
public void Mark() ; public int Move(int x)
public int Cook(int x) ; public void Cook(int x, double y)
public int Add(int x) ; public int Add(int y)
All of the above
Only A and C
Question 7. Question : (TCO 5) Consider the following class definition.
public static void Main(string[] args)
{
Building ranch = new Building();
}
public class Building
{
private int floors;
private double cost;
public Building()
{
floors = 2;
cost = 25.0;
}
public int Floors()
{
return floors;
}
public double Cost()
{
return cost;
}
public double Cost(int extra)
{
return cost + extra;
}
}
Which of the following is/are true?
(i) The data member floors can be set to a new value, by a user
of this class.
(ii) The default constructor initializes the state variables.
(iii) We could use Building.Floors() to access the data memberfloors.
Only (i)
Only (ii)
All (i), (ii), and (iii) are true
None are true
Question 8. Question : (TCO 2) Can two methods each define a local variable with the same name?
Yes, as long as the variable is used in the same way.
No, this is not possible because the compiler would not know which variable to use.
Yes, but only if the methods have the same name.
None of the above
Question 9. Question : (TCO 5) Which error handling technique(s) is(are) not appropriate when developing an application?
Check for potential problems and abort the application when a problem is encountered.
Ignore an error in the application.
Check for potential problems, catch the mistake, and try to fix it.
All of the above
Question 10. Question : (TCO 2) Assume a class contains two non-static data members and one static data member. If two objects have been instantiated from the class, how many copies of the static data member exist?
3
6
2
1
-
Rating:
/5
Solution: Devry CIS247 Week 2 Quiz Latest 2016 Jan.