A class header or class definition can contain all of the following except ________________.
A. initial field values
Most fields in a class are created with ____________ modifier.
A. private
Most methods in a class are created with _______________ modifier.
A. public
Instance methods that belong to individual objects are _____________ static methods.
D. never
To allocate memory for an object instantiation, you must use the ______________ operator.
C. new
Assume that you have created a class named MyClass. The header of the MyClass constructor can be _______________.
A. Neither of these can be the the constructor header.
Assume that you have created a class named MyClass. The header of the MyClass constructor can be _________________.
A. Either of these can be the constructor header.
Assume that you have created a class named DemoCar. Within the Main() method of this class, you instantiate a Car object named myCar and the following statement executes correctly:
WriteLine("The Car gets {0} miles per gallon", myCar.ComputeMpg());
Within the Car class, the ComputeMpg() method can be __________.
D. public and nonstatic
Assume that you have created a class named TermPaper that contains a character field named letterGrade. You also have created a property for the field. Which of the following cannot be true?
B. The property name is letterGrade.
A this reference is _______________.
A. implicitly passed to nonstatic methods
When you use an instance variable within a class's nonstatic methods, you ________________ explicitly refer to the method's this reference.
A. can
A class's default constructor ______________.
C. is both of these
Assume that you have created a class named Chair with a constructor defined as Chair(int height). Which of the following overloaded constructors could coexist with the Chair constructor without ambiguity?
C. Chair(int height, int legs)
Which of the following statements correctly instantiates a House object if the House class contains a single constructor with the declaration House(int bedrooms, double price)?
B. Two of these
You explicitly call a destructor ______________.
D. You cannot explicitly call a destructor
In a program that creates five object instances of a class, the constructor executes __________ time(s) and the destructor executes ____________ time(s).
C. five; five
Suppose that you declare a class named Furniture that contains a string field named woodType and a conventionally named property with a get accessor. When you declare an array of 200 Furniture objects named myChairs, which of the following accesses the last Furniture object's wood type?
D. myChairs[199].WoodType
A collection of methods that can be used by any class, as long as the class provides a definition to override the collection's abstract definitions, is ______________.
D. an interface
When you create a class and want to include the capability to compare its objects so they can use the Array.Sort() or Array.BinarySearch() method, you must _______________.