10 MCQ Only those class members which are hidden from users of the class are part of the

Ratings: 1 Star2 Stars3 Stars4 Stars5 Stars (5.00 out of 5) - Rate Now!
Loading...

Download Category:

10 MCQ Only those class members which are hidden from users of the class are part of the.zip - (133.57 KB)
[
10 MCQ Only those class members which are hidden from users of the class are part of the/10 MCQ Only those class members which are hidden from users of the class are part of the.docx
10 MCQ Only those class members which are hidden from users of the class are part of the/Question.txt
10 MCQ Only those class members which are hidden from users of the class are part of the/Screenshot_1.png
]

1. (TCO 2) Only those class members which are hidden from users of the class are part of the _____ of the class. (Points : 2)
interface
implementation
constructors
GUI (graphical user interface)

2. (TCO 2) A private attribute can have an associated public _____ to allow an outside class to retrieve its value. (Points : 2)
constructor
destructor
getter
mutator

3. (TCO 2) Which of the following statements is/are true? (Points : 2)
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

4. (TCO 2) A Waiter is responsible for taking the order from the Customer, 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 Chef object, which of the following would you consider as (an) appropriate message(s) the Chef should respond to? (Points : 2)
“Take a pound of ground meat, add a chopped onion, salt, pepper, parsley and broil for 15 minutes until the burger becomes golden brown.”
“What do you do after work?”
“Prepare a steak, medium-rare.”
All of the above
Only A and C

5. (TCO 5) Code inside a _____ should set the newly created object to its initial _____ state. (Points : 2)
method; public
constructor; private
class; persistent
constructor; stable

6. (TCO 5) Which of the following method pairs depict method overloading? (Points : 2)
public int Move() ; public int Move(int x)
public int Charge(int x) ; public void Charge(int x, int y)
public int Add( int x, int y) ; public void Add(int y, int x)
All of the above
Only A and B

7. (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 member floors.
(Points : 2)
Only (i)
Only (ii)
All (i), (ii), and (iii) are true
None are true

8. (TCO 2) Can two methods each define a local variable with the same name? (Points : 2)
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

9. (TCO 5) Which error handling technique is the least appropriate when developing an application?
(Points : 2)
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.

10. (TCO 2) Which is an appropriate choice for a static attribute in a Building class?
(Points : 2)
numberOfBuildings
numberOfApartments
numberOfFloors
None of the above

Get a fresh solution of this question. Ask it now to our experts.
doubt

Ask Your Question

We have verified professionals who are ready to answer your question.

time

Save Time and Money

We choose experts who can quickly answer your question and that suit your budget.

download

Get Your Answer

Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.