C# unit 1 test ch 4
____ are special methods used to read the current state or value of an object member's data.
Accessors
Design your classes to be as flexible and full-featured as possible. One way to do this is to include multiple instance data members.
False
Which of the following is NOT one of the inherited member methods of the object class?
Main( )
After a project has been created and a new class added to your application, you can use the ____________ Window in Visual Studio to create a class diagram.
Solution Explorer
Which of the following is NOT a true statement relating to constructors? a. If you write one constructor, you lose the default one that is created automatically. b. Constructors are used to provide values to the object's data members. c. Correct! The default constructor must be the first one written for the class. d. To add full functionality to your classes, write multiple constructors
The default constructor must be the first one written for the class.
Which of the following is true regarding methods of a class? a. To call methods of the class in the class, you must prefix the method name with the class name. b. You must use the keyword static. c. No return type is used when you define a class method. d. They are called instance methods.
They are called instance methods.
WriteLine("Value = {0:N0}", 12345.9032); What will be displayed from the above line? a. Value = 12,345 b. Value = 12,346 c. Value = 12,346.0 d. Value = 12346
Value = 12,346
The ToString( ) method is automatically invoked when an object reference is made in the ____.
Write( ) method
plush.PricePerSqYard = 40.99; If proper naming conventions were used in the above statement, which of the following statements is true? a. all of the above b 40.99 is a numeric literal c. plush is an object d. PricePerSqYard is a property
all of the above
Constructors ____. a. do not return a value. b. do not have to be written. c. all of the above. d.can be overloaded.
all of the above.
In order to test a class, ____. a. all of the above. b. invoke instance methods using the objects you construct. c. use the properties to assign and retrieve values. d. a different class is needed.
all of the above.
Local variables ____. a. are defined inside Main( ) and other methods b. are defined in classes c. must be defined as private d. determine the data characteristics for the class
are defined inside Main( ) and other methods
The body of the constructor methods consist primarily of ____________.
assignment statements
When you define the class, you describe its ____________, or characteristics or fields, in terms of data.
attributes
C# is an object-oriented language as such all the code that you write has to be placed in a(n) ____________.
class
By abstracting out the attributes (data) and the behaviors (processes on the data), you can create a(n) ____________ to serve as a template from which many objects of that type can be instantiated.
class0
A property resembles a(n) ____, but is more closely aligned to a(n) ____.
data field, method
Instance methods manipulate data by ____.
directly accessing private data members.
A class is normally associated with a(n) ____, which often describes a person, place, or thing and is normally a noun.
entity
A constructor is used to instantiate a class from an object.
false
If you overwrite the ToString( ) method, you should also override the other methods of the object class.
false
The ToString( ) method of the Console class should be overwritten.
false
When you define a class method, you define its characteristics or fields in terms of the data.
false
Accessors are also referred to as ____.
getters
To design a class that is flexible and full-featured, ____.
include multiple constructors.
Accessor and mutators are ____________ methods
instance
The static keyword must not be used with ____.
instance methods
Fields or data members are also called ____________.
instance variables
Instance methods are ____.
nonstatic methods.
To program an object-oriented solution begin by determining what ____ are needed in the solution.
objects
Variables declared in the Main( ) method are ____. a. visible inside any method in the class. b. are automatically initialized to zero. c. must be defined as private data members. d. only visible inside Main( ).
only visible inside Main( ).
Class methods manipulate data by ____.
passing information as arguments through parameters.
Data members should be defined with an access mode of ____________.
private
Normally data members are defined to have ____ access.
private
During the design phase, it is important to develop a(n) ____________ illustrating what the desired final output should be.
prototype
Accessors, mutators, and other instance methods are normally defined with what type of access modifier?
public
Constructors should be defined with a ____ access modifier.
public
To define a property to change a data member of a class include a ____ clause.
set
Three of the contextual keywords associated with properties are get, set, and value.
true
ToString( ), Equals( ), GetType( ), and GetHashCode( ) are all methods of the object class.
true
With the object-oriented approach, objects send messages to other objects and receive messages from objects.
true
In order to provide a new definition for the ToString( ) method, ____.
use the keyword override in the heading
Constructors differ from other methods in that constructors ____.
use the same identifier as the class
To add full functionality to your classes, ____.
write more than one constructor