Exam 2 (ch 3) Flashcards

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
A

True

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

A

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

A

True

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

A

True

24
Q

A namespace is really nothing more than a group of statements placed together under a single name
True or false

A

True

25
Q
Methods can be defined globally outside of a class in C#
True or false
A

False

26
Q

The definition for a method just includes the heading. The signature includes the heading and the body of the method.
True or false

A

False

The definition is inside the curly braces

27
Q
Methods that use the static modifier are called class methods.
True or false
A

True

28
Q

C# offers both call by value and call by reference parameters. Call by value is the default type
True or false

A

True

29
Q

_____ is an overloaded method of the Math class that returns the larger if he two specified numbers.

A

Max

30
Q

Calls to _____ methods must be placed at a location in your code where the value could be accepted when the method is finished.

A

Value returning

31
Q

_____ is used to indicate that no value is being returned from a method.

A

Void

32
Q

The term _____ is often used to indicate where an identifier has meaning and can be used.

A

Scope

33
Q

Call by _____ is the default parameter type.

A

Value

34
Q

When you assign a default value to a parameter, it hen becomes a(n) _____ parameter.

A

Optional

35
Q

When naming local variable identifiers and parameters, use _____.

A

Camel case

36
Q

Avoid writing long methods. Consider refactoring when the method exceeds _____ lines of code.

A

25

37
Q

All programs consist of at least one _____.

A

Main

38
Q

When naming a(n) _____, use the action verb phrase.

A

Method

39
Q

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.

A

ReadKey( )

40
Q

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.

A

Static

41
Q

_____ access offers the fewest access limitations; there are basically no restrictions on accessing _____ members or classes.

A

Public

42
Q

When a class or class member does not specify a modifier, the default accessibility level of _____ is assumed.

A

Private

43
Q

The _____ type is always listed immediately preceding the name of the method.

A

Return

44
Q

With overload methods, _____ must differ.

A

Signatures

45
Q

During the design phase, it is important to develop a(n) _____ illustrating what the desired final output should be.

A

Prototype

46
Q

Standard convention used for class:

A

Pascal case

47
Q

Standard convention used for method identifiers:

A

Pascal case

48
Q

Standard convention used for data member identifiers:

A

Camel case