Exam 2 (ch 3) Flashcards
Methods may be defined in any order and placed anywhere in the file, in or outside of the class.
True or false
False.
Only inside the class
Methods are the members of a class that perform an action, and through writing methods you describe the behavior of data. True or false.
True
Consol applications require a Main( ) method, unlike Windows applications that do not require a Main( ) method.
True or false
False
The definition of the method includes the entry inside the curly braces, which is sometimes called the body of the method.
True or false
True
A semi colon is placed on the end of a method heading following the parameter list.
True or false
False
There is no semi colon after defining a method. But there is when calling a method
One required entry for a method heading is the return type.
True or false
True
In order to indicate a value is constant and cannot be changed, the keyword constant is added
True or false
False
The keyword is Const
In order to call a static method from another class, the class name must be used with a method name True or false
True
The following are examples of the access modifiers available in C#: public, personal, protected
True or false
False
Personal is not one, others are private, internal and protected internal
The accessibility modifier identifies what type of value is returned when the method is complete.
True or false
False
This is describing the return value
If a method does not return a value, the void keyword is placed inside the parentheses in the method heading
True or false
False
It’s placed right before the method name
A standard convention used by programmers for naming classes is to use an action verb phrase
True or false
False
This is for naming methods
A standard convention used by C# programmers is to use the Pascal case style for class, data member identifiers, and method identifiers.
True or false
False
The entries found inside the parentheses of the method headings are called the access modifiers.
True or false
False
These are the parameters or arguments
The body of a method can include statements that declare other methods
True or false
False
They can only call other methods in the body of a method
The Console class is defined in the System namespace True or false
True
The name of the method, modifiers, return type and the types of its formal parameters make up the signature of the method
True or false
False
The Write( ), WriteLine( ), Read( ), and ReadLine( ) methods are all overloaded True or false
False
Read( ) and ReadLine( ) are not overloaded
The Read( ) method is different from the ReadLine( ) method in that the Read( ) returns an int and the ReadLine( ) returns a string argument True or false
True
The Parse( ) method returns the number representation of its string argument True or false
True
Ceiling( ), Pow( ), and Floor( ) are all static members of the Console class True or false
False
They are of the Math class
The return keyword may not be included with a non-value returning method (void method)
True or false
False
One way to ensure that you have one entry and exit from a method is to include a single return statement as the last statement in the method.
True or false
True
Both out and ref parameter types cause a method to refer to the same variable that was passed into the method
True or false
True
A namespace is really nothing more than a group of statements placed together under a single name
True or false
True
Methods can be defined globally outside of a class in C# True or false
False
The definition for a method just includes the heading. The signature includes the heading and the body of the method.
True or false
False
The definition is inside the curly braces
Methods that use the static modifier are called class methods. True or false
True
C# offers both call by value and call by reference parameters. Call by value is the default type
True or false
True
_____ is an overloaded method of the Math class that returns the larger if he two specified numbers.
Max
Calls to _____ methods must be placed at a location in your code where the value could be accepted when the method is finished.
Value returning
_____ is used to indicate that no value is being returned from a method.
Void
The term _____ is often used to indicate where an identifier has meaning and can be used.
Scope
Call by _____ is the default parameter type.
Value
When you assign a default value to a parameter, it hen becomes a(n) _____ parameter.
Optional
When naming local variable identifiers and parameters, use _____.
Camel case
Avoid writing long methods. Consider refactoring when the method exceeds _____ lines of code.
25
All programs consist of at least one _____.
Main
When naming a(n) _____, use the action verb phrase.
Method
One option to holding the screen at the end of the program is to invoke Console.Read( ). Another option is to call _____. It obtains the next character or function key from the user.
ReadKey( )
All Main( ) method headings must include the _____ modifier meaning that the method belongs to the type itself rather than to a specific object of a class.
Static
_____ access offers the fewest access limitations; there are basically no restrictions on accessing _____ members or classes.
Public
When a class or class member does not specify a modifier, the default accessibility level of _____ is assumed.
Private
The _____ type is always listed immediately preceding the name of the method.
Return
With overload methods, _____ must differ.
Signatures
During the design phase, it is important to develop a(n) _____ illustrating what the desired final output should be.
Prototype
Standard convention used for class:
Pascal case
Standard convention used for method identifiers:
Pascal case
Standard convention used for data member identifiers:
Camel case