Multiple Choice Identify the
choice that best completes the statement or answers the question.
|
|
1.
|
plush.PricePerSqYard = 40.99; If proper naming conventions were used in the
above statement, which of the following statements is true?
a. | PricePerSqYard is a property | c. | 40.99 is a numeric
value | b. | plush is an object | d. | all of the above |
|
|
2.
|
A method used to convert from one base type to another is ____.
a. | ChangeValue | c. | ToDouble | b. | Convert() | d. | Convert.ToDouble() |
|
|
3.
|
Which of the following is NOT a parameter type?
|
|
4.
|
Local variables _____.
a. | are defined inside Main() and other methods | c. | are defined in
class | b. | must be defined as private | d. | determine the data characteristics for the class |
|
|
5.
|
Accessors are also referred to as ____.
a. | mutators | c. | properties | b. | getters | d. | Classes |
|
|
6.
|
double answer = Math.Pow(3, 2); The result of the call to Math.Pow( ) in the
above statement is to store ____ in answer:
a. | 9 | c. | 6 | b. | 3,2 | d. | an error
message |
|
|
7.
|
The Math class has a number of static methods located in the ____
namespace.
a. | Math | c. | IO | b. | System | d. | Arithmetic |
|
|
8.
|
Which of the following is true regarding methods of a class?
a. | You must use the keyword static. | c. | To call methods of the class in the
class, you must prefix the method name with the class name. | b. | They are called
instance methods | d. | No return
type is used when you define a class method. |
|
|
9.
|
A property resembles a(n) ____, but is more closely aligned to a(n) ____.
a. | data field, method | c. | object, mutator | b. | method, data field | d. | mutator,
accessor |
|
|
10.
|
WriteLine(“Final Grade = {0:N2}”, CalculateGrade(90, 75,
83)); The {0:N2} above indicates the ____.
a. | first argument should display no digits to the right of the decimal | c. | the argument should
be displayed with 0 digits to the left of the decimal and two digits to the right of the
decimal | b. | first argument should display two digits to the right of the
decimal | d. | the argument should
be displayed with 0 digits to the right of the decimal and two digits to the left of the
decimal |
|
|
11.
|
In order to call or invoke a nonvalue-returning method, enter the ____.
a. | access modifier followed by the method identifier and list of
arguments | c. | method’s identifier followed by list of arguments | b. | return type followed
by the method identifier and list of parameters | d. | access modifier, return type, and
method’s identifier followed by list of parameters |
|
|
12.
|
The ____ specifies what kind of information is returned when the body of the
method is finished executing.
a. | access modifiers | c. | static modifier | b. | parameters | d. | returnType |
|
|
13.
|
The static keyword must not be used with ____.
a. | date members | c. | class methods | b. | instance methods | d. | all of the
above |
|
|
14.
|
WriteLine(“Final Grade = {0:N2}”, CalculateGrade(90, 75, 83)); In the statement above,
CalculateGrade(90, 75, 83) is ____.
a. | a method call | c. | an identifier of the class | b. | a method
declaration | d. | a parameter for
the WriteLin() method |
|
|
15.
|
WriteLine(“Value = {0:N0}”, 12345.9032); What will be displayed
from the above line?
a. | Value = 12,346 | c. | Value = 12,354 | b. | Value = 12356 | d. | Value =
12,346.0 |
|
True/False Indicate whether the
statement is true or false.
|
|
16.
|
ToString( ), Equals( ), GetType( ), and GetHashCode( ) are all methods of the
object class.
|
|
17.
|
Design your classes to be as flexible and full-featured as possible. One way to
do this is to include multiple instance data members.
|
|
18.
|
When you define a class method, you define its characteristics or fields in
terms of the data.
|
|
19.
|
A standard convention used by C# programmers is to use camel case style for
property identifiers; Camel case style convention is also used for data member identifiers.
|
|
20.
|
Use a type prefix, such as C for class name. For example, a student class should
be named CStudent.
|
|
21.
|
The return type for constructors is always the type of the class.
|
|
22.
|
In order to indicate a value is constant and cannot be changed, the keyword
constant is added.
|
|
23.
|
A standard convention used by C# programmers is to use Pascal case style for
class, data member identifiers, and method identifiers.
|
|
24.
|
Ceiling( ), Pow( ), and Floor( ) are all static members of the Console
class.
|
|
25.
|
The body of a method can include statements that declare other methods.
|