Exam 2 (ch 3) Flashcards

(49 cards)

0
Q

Methods may be defined in any order and placed anywhere in the file, in or outside of the class.
True or false

A

False.

Only inside the class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q
Methods are the members of a class that perform an action, and through writing methods you describe the behavior of data. 
True or false.
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Consol applications require a Main( ) method, unlike Windows applications that do not require a Main( ) method.
True or false

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The definition of the method includes the entry inside the curly braces, which is sometimes called the body of the method.
True or false

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A semi colon is placed on the end of a method heading following the parameter list.
True or false

A

False

There is no semi colon after defining a method. But there is when calling a method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

One required entry for a method heading is the return type.

True or false

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In order to indicate a value is constant and cannot be changed, the keyword constant is added
True or false

A

False

The keyword is Const

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
In order to call a static method from another class, the class name must be used with a method name 
True or false
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The following are examples of the access modifiers available in C#: public, personal, protected
True or false

A

False

Personal is not one, others are private, internal and protected internal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The accessibility modifier identifies what type of value is returned when the method is complete.
True or false

A

False

This is describing the return value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

If a method does not return a value, the void keyword is placed inside the parentheses in the method heading
True or false

A

False

It’s placed right before the method name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A standard convention used by programmers for naming classes is to use an action verb phrase
True or false

A

False

This is for naming methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The entries found inside the parentheses of the method headings are called the access modifiers.
True or false

A

False

These are the parameters or arguments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The body of a method can include statements that declare other methods
True or false

A

False

They can only call other methods in the body of a method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
The Console class is defined in the System namespace
True or false
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

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

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q
The Write( ), WriteLine( ), Read( ), and ReadLine( ) methods are all overloaded 
True or false
A

False

Read( ) and ReadLine( ) are not overloaded

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q
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
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q
The Parse( ) method returns the number representation of its string argument
True or false
20
Q
Ceiling( ), Pow( ), and Floor( ) are all static members of the Console class 
True or false
A

False

They are of the Math class

21
Q

The return keyword may not be included with a non-value returning method (void method)
True or false

22
Q

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

23
Q

Both out and ref parameter types cause a method to refer to the same variable that was passed into the method
True or false

24
A namespace is really nothing more than a group of statements placed together under a single name True or false
True
25
``` Methods can be defined globally outside of a class in C# True or false ```
False
26
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
27
``` Methods that use the static modifier are called class methods. True or false ```
True
28
C# offers both call by value and call by reference parameters. Call by value is the default type True or false
True
29
_____ is an overloaded method of the Math class that returns the larger if he two specified numbers.
Max
30
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
31
_____ is used to indicate that no value is being returned from a method.
Void
32
The term _____ is often used to indicate where an identifier has meaning and can be used.
Scope
33
Call by _____ is the default parameter type.
Value
34
When you assign a default value to a parameter, it hen becomes a(n) _____ parameter.
Optional
35
When naming local variable identifiers and parameters, use _____.
Camel case
36
Avoid writing long methods. Consider refactoring when the method exceeds _____ lines of code.
25
37
All programs consist of at least one _____.
Main
38
When naming a(n) _____, use the action verb phrase.
Method
39
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( )
40
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
41
_____ access offers the fewest access limitations; there are basically no restrictions on accessing _____ members or classes.
Public
42
When a class or class member does not specify a modifier, the default accessibility level of _____ is assumed.
Private
43
The _____ type is always listed immediately preceding the name of the method.
Return
44
With overload methods, _____ must differ.
Signatures
45
During the design phase, it is important to develop a(n) _____ illustrating what the desired final output should be.
Prototype
46
Standard convention used for class:
Pascal case
47
Standard convention used for method identifiers:
Pascal case
48
Standard convention used for data member identifiers:
Camel case