Deck 7: Using Methods

ملء الشاشة (f)
exit full mode
سؤال
With ____, if a programmer changes the way in which a method internally works, programs that use that method will not be affected and will not need to be modified.

A) overloading
B) implementation hiding
C) polymorphism
D) inheritance
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Because the ReadLine() method call can be assigned to a string, its return type is ____ .

A) int
B) Object
C) bool
D) string
سؤال
The type of an argument in a method call must exactly match the type of the corresponding parameter specified in the method declaration.
سؤال
If you use the keyword modifier ____, you indicate that a method can be called by referring to the class rather than an object from the class.

A) static
B) internal
C) protected
D) nonstatic
سؤال
A method ____ is a variable that holds data passed to the method when it is called; it receives an argument's value when the method executes.

A) element
B) parameter
C) literal
D) declaration
سؤال
The ____ accessibility modifier allows access to a method from other classes.

A) public
B) protected
C) private
D) protected internal
سؤال
A program element's ____ is the segment of code in which it can be used.

A) scope
B) locality
C) accessibility
D) nesting
سؤال
A declaration for a method that receives two or more arguments must list the type for each parameter separately only if the parameters have different types.
سؤال
A parameter within a method header is called a(n) ____ parameter.

A) formal
B) local
C) global
D) actual
سؤال
A method can return, at most, one value to a method that calls it.
سؤال
To more easily incorporate methods into a program, it is common practice to store methods in their own classes and files. Then you can add them into any application that uses them. The resulting compound program is called a(n) ____.

A) interface
B) multifile assembly
C) hid assembly
D) hid implementation
سؤال
A(n) ____ is a device you can use without knowing how it works internally.

A) white box
B) interface
C) black box
D) method
سؤال
Methods can ____, or call, other methods; that is, a program uses a method's name and the method performs a job for the class.

A) instantiate
B) overload
C) inherit
D) invoke
سؤال
The ____ accessibility modifier limits method access to the class that contains the method.

A) protected
B) private
C) protected internal
D) internal
سؤال
If you do not provide an accessibility modifier for a method, it is private by default.
سؤال
A method that uses another is called a ____ of the method it uses.

A) peer
B) server
C) pair
D) client
سؤال
The number of arguments does not need to match the number in the parameter list when you use ____.

A) default arguments
B) value parameters
C) scope relaxation
D) non-critical parameters
سؤال
Arrays, like all objects, are passed by value.
سؤال
The optional declared ____ for a method (for example, public ) sets limits as to how other methods can use it.

A) protection
B) qualifier
C) accessibility
D) type
سؤال
A formal parameter that receives a copy of the value passed to it is also an example of a(n) ____ parameter.

A) reference
B) output
C) input
D) value
سؤال
What are the components of a C# method declaration?
سؤال
Match between columns
Receives a copy of the value passed to it
parameter list
Receives a copy of the value passed to it
fully qualified name
Receives a copy of the value passed to it
value parameter
Receives a copy of the value passed to it
nonstatic method
Receives a copy of the value passed to it
local variable
Receives a copy of the value passed to it
calling method
Receives a copy of the value passed to it
field
Receives a copy of the value passed to it
bool
Receives a copy of the value passed to it
object's starting memory address
Optionally present within parentheses after the method name in a method declaration
parameter list
Optionally present within parentheses after the method name in a method declaration
fully qualified name
Optionally present within parentheses after the method name in a method declaration
value parameter
Optionally present within parentheses after the method name in a method declaration
nonstatic method
Optionally present within parentheses after the method name in a method declaration
local variable
Optionally present within parentheses after the method name in a method declaration
calling method
Optionally present within parentheses after the method name in a method declaration
field
Optionally present within parentheses after the method name in a method declaration
bool
Optionally present within parentheses after the method name in a method declaration
object's starting memory address
Can only be used in conjunction with an object
parameter list
Can only be used in conjunction with an object
fully qualified name
Can only be used in conjunction with an object
value parameter
Can only be used in conjunction with an object
nonstatic method
Can only be used in conjunction with an object
local variable
Can only be used in conjunction with an object
calling method
Can only be used in conjunction with an object
field
Can only be used in conjunction with an object
bool
Can only be used in conjunction with an object
object's starting memory address
One that calls another method
parameter list
One that calls another method
fully qualified name
One that calls another method
value parameter
One that calls another method
nonstatic method
One that calls another method
local variable
One that calls another method
calling method
One that calls another method
field
One that calls another method
bool
One that calls another method
object's starting memory address
A method's complete name including its class
parameter list
A method's complete name including its class
fully qualified name
A method's complete name including its class
value parameter
A method's complete name including its class
nonstatic method
A method's complete name including its class
local variable
A method's complete name including its class
calling method
A method's complete name including its class
field
A method's complete name including its class
bool
A method's complete name including its class
object's starting memory address
The return type for a method that returns either true or false
parameter list
The return type for a method that returns either true or false
fully qualified name
The return type for a method that returns either true or false
value parameter
The return type for a method that returns either true or false
nonstatic method
The return type for a method that returns either true or false
local variable
The return type for a method that returns either true or false
calling method
The return type for a method that returns either true or false
field
The return type for a method that returns either true or false
bool
The return type for a method that returns either true or false
object's starting memory address
What is received by an invoked method when an object is passed to it by reference
parameter list
What is received by an invoked method when an object is passed to it by reference
fully qualified name
What is received by an invoked method when an object is passed to it by reference
value parameter
What is received by an invoked method when an object is passed to it by reference
nonstatic method
What is received by an invoked method when an object is passed to it by reference
local variable
What is received by an invoked method when an object is passed to it by reference
calling method
What is received by an invoked method when an object is passed to it by reference
field
What is received by an invoked method when an object is passed to it by reference
bool
What is received by an invoked method when an object is passed to it by reference
object's starting memory address
This kind of variable is declared within a method and is not known to other methods
parameter list
This kind of variable is declared within a method and is not known to other methods
fully qualified name
This kind of variable is declared within a method and is not known to other methods
value parameter
This kind of variable is declared within a method and is not known to other methods
nonstatic method
This kind of variable is declared within a method and is not known to other methods
local variable
This kind of variable is declared within a method and is not known to other methods
calling method
This kind of variable is declared within a method and is not known to other methods
field
This kind of variable is declared within a method and is not known to other methods
bool
This kind of variable is declared within a method and is not known to other methods
object's starting memory address
A variable declared within a class but outside of the class's methods
parameter list
A variable declared within a class but outside of the class's methods
fully qualified name
A variable declared within a class but outside of the class's methods
value parameter
A variable declared within a class but outside of the class's methods
nonstatic method
A variable declared within a class but outside of the class's methods
local variable
A variable declared within a class but outside of the class's methods
calling method
A variable declared within a class but outside of the class's methods
field
A variable declared within a class but outside of the class's methods
bool
A variable declared within a class but outside of the class's methods
object's starting memory address
سؤال
What are the components of a C# method?
سؤال
Every method has a(n) ____________________, indicating what kind of value the method will return to any other method that calls it.
سؤال
You indicate that a method parameter is an array by placing ____ after the data type in the method's parameter list.

A) ()
B) $
C) []
D) {}
سؤال
The keyword static is used with Main() methods in console applications because the method is associated with its containing class and not with an object. Why are Form methods, such as a Click() method that responds to button clicks, nonstatic?
سؤال
You can tell a lot about a built-in method when you see how it is used. What can you tell about the built-in Pow() method (used to raise a number to a power) from the following statement?
double result = Math.Pow(2.0, 3.0);
سؤال
Describe how nested method calls work. For example, if you have three nested method calls, which method executes first and how are return values propagated? Is there a limit to how many method calls can be nested?
سؤال
If a method does not return a value, its return type is ____________________.
سؤال
A(n) ____________________ is an encapsulated series of statements that carry out a task.
سؤال
A method ____________________ is a block of statements that carry out the method's work.
سؤال
If you create a Click() method that responds to button clicks, it will be ____ by default because it is associated with an object that is a Form .

A) local
B) static
C) qualified
D) nonstatic
سؤال
A method ____________________ defines the rules for using the method and can include accessibility, static, and return type modifiers.
سؤال
A ____ statement causes a value to be sent back to the calling method.

A) break
B) result
C) return
D) continue
سؤال
When you place a Button named okButton on a Form in the IDE and double-click it, a method is automatically generated with the following header: ____ okButton_Click( object sender, EventArgs e) .

A) public void
B) private void
C) static void
D) private int
سؤال
When method calls are placed inside other method calls, the calls are ____ method calls.

A) nested
B) interleaved
C) cascaded
D) children
سؤال
Write a DisplaySalesTax() method that receives the sales amount and tax rate as double s, and calculates and displays the sales tax. The method does not return a value.
سؤال
When an array passed to a method is passed by ____, the method receives the actual memory address of the array and has access to the actual values in the array elements.

A) reference
B) value
C) output
D) input
سؤال
For a method that accepts a parameter, what are the components of the parameter definition that must be included in the method declaration? Show an example of a method declaration with a parameter.
سؤال
What are the two most common accessibility levels in C#?
سؤال
Explain how to write a Main() method that accepts parameters. Why might this format be used?
سؤال
When writing an event-handling method in a GUI application, what should you consider about a variable's scope?
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/42
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 7: Using Methods
1
With ____, if a programmer changes the way in which a method internally works, programs that use that method will not be affected and will not need to be modified.

A) overloading
B) implementation hiding
C) polymorphism
D) inheritance
B
2
Because the ReadLine() method call can be assigned to a string, its return type is ____ .

A) int
B) Object
C) bool
D) string
D
3
The type of an argument in a method call must exactly match the type of the corresponding parameter specified in the method declaration.
False
4
If you use the keyword modifier ____, you indicate that a method can be called by referring to the class rather than an object from the class.

A) static
B) internal
C) protected
D) nonstatic
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
5
A method ____ is a variable that holds data passed to the method when it is called; it receives an argument's value when the method executes.

A) element
B) parameter
C) literal
D) declaration
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
6
The ____ accessibility modifier allows access to a method from other classes.

A) public
B) protected
C) private
D) protected internal
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
7
A program element's ____ is the segment of code in which it can be used.

A) scope
B) locality
C) accessibility
D) nesting
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
8
A declaration for a method that receives two or more arguments must list the type for each parameter separately only if the parameters have different types.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
9
A parameter within a method header is called a(n) ____ parameter.

A) formal
B) local
C) global
D) actual
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
10
A method can return, at most, one value to a method that calls it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
11
To more easily incorporate methods into a program, it is common practice to store methods in their own classes and files. Then you can add them into any application that uses them. The resulting compound program is called a(n) ____.

A) interface
B) multifile assembly
C) hid assembly
D) hid implementation
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
12
A(n) ____ is a device you can use without knowing how it works internally.

A) white box
B) interface
C) black box
D) method
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
13
Methods can ____, or call, other methods; that is, a program uses a method's name and the method performs a job for the class.

A) instantiate
B) overload
C) inherit
D) invoke
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
14
The ____ accessibility modifier limits method access to the class that contains the method.

A) protected
B) private
C) protected internal
D) internal
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
15
If you do not provide an accessibility modifier for a method, it is private by default.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
16
A method that uses another is called a ____ of the method it uses.

A) peer
B) server
C) pair
D) client
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
17
The number of arguments does not need to match the number in the parameter list when you use ____.

A) default arguments
B) value parameters
C) scope relaxation
D) non-critical parameters
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
18
Arrays, like all objects, are passed by value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
19
The optional declared ____ for a method (for example, public ) sets limits as to how other methods can use it.

A) protection
B) qualifier
C) accessibility
D) type
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
20
A formal parameter that receives a copy of the value passed to it is also an example of a(n) ____ parameter.

A) reference
B) output
C) input
D) value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
21
What are the components of a C# method declaration?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
22
Match between columns
Receives a copy of the value passed to it
parameter list
Receives a copy of the value passed to it
fully qualified name
Receives a copy of the value passed to it
value parameter
Receives a copy of the value passed to it
nonstatic method
Receives a copy of the value passed to it
local variable
Receives a copy of the value passed to it
calling method
Receives a copy of the value passed to it
field
Receives a copy of the value passed to it
bool
Receives a copy of the value passed to it
object's starting memory address
Optionally present within parentheses after the method name in a method declaration
parameter list
Optionally present within parentheses after the method name in a method declaration
fully qualified name
Optionally present within parentheses after the method name in a method declaration
value parameter
Optionally present within parentheses after the method name in a method declaration
nonstatic method
Optionally present within parentheses after the method name in a method declaration
local variable
Optionally present within parentheses after the method name in a method declaration
calling method
Optionally present within parentheses after the method name in a method declaration
field
Optionally present within parentheses after the method name in a method declaration
bool
Optionally present within parentheses after the method name in a method declaration
object's starting memory address
Can only be used in conjunction with an object
parameter list
Can only be used in conjunction with an object
fully qualified name
Can only be used in conjunction with an object
value parameter
Can only be used in conjunction with an object
nonstatic method
Can only be used in conjunction with an object
local variable
Can only be used in conjunction with an object
calling method
Can only be used in conjunction with an object
field
Can only be used in conjunction with an object
bool
Can only be used in conjunction with an object
object's starting memory address
One that calls another method
parameter list
One that calls another method
fully qualified name
One that calls another method
value parameter
One that calls another method
nonstatic method
One that calls another method
local variable
One that calls another method
calling method
One that calls another method
field
One that calls another method
bool
One that calls another method
object's starting memory address
A method's complete name including its class
parameter list
A method's complete name including its class
fully qualified name
A method's complete name including its class
value parameter
A method's complete name including its class
nonstatic method
A method's complete name including its class
local variable
A method's complete name including its class
calling method
A method's complete name including its class
field
A method's complete name including its class
bool
A method's complete name including its class
object's starting memory address
The return type for a method that returns either true or false
parameter list
The return type for a method that returns either true or false
fully qualified name
The return type for a method that returns either true or false
value parameter
The return type for a method that returns either true or false
nonstatic method
The return type for a method that returns either true or false
local variable
The return type for a method that returns either true or false
calling method
The return type for a method that returns either true or false
field
The return type for a method that returns either true or false
bool
The return type for a method that returns either true or false
object's starting memory address
What is received by an invoked method when an object is passed to it by reference
parameter list
What is received by an invoked method when an object is passed to it by reference
fully qualified name
What is received by an invoked method when an object is passed to it by reference
value parameter
What is received by an invoked method when an object is passed to it by reference
nonstatic method
What is received by an invoked method when an object is passed to it by reference
local variable
What is received by an invoked method when an object is passed to it by reference
calling method
What is received by an invoked method when an object is passed to it by reference
field
What is received by an invoked method when an object is passed to it by reference
bool
What is received by an invoked method when an object is passed to it by reference
object's starting memory address
This kind of variable is declared within a method and is not known to other methods
parameter list
This kind of variable is declared within a method and is not known to other methods
fully qualified name
This kind of variable is declared within a method and is not known to other methods
value parameter
This kind of variable is declared within a method and is not known to other methods
nonstatic method
This kind of variable is declared within a method and is not known to other methods
local variable
This kind of variable is declared within a method and is not known to other methods
calling method
This kind of variable is declared within a method and is not known to other methods
field
This kind of variable is declared within a method and is not known to other methods
bool
This kind of variable is declared within a method and is not known to other methods
object's starting memory address
A variable declared within a class but outside of the class's methods
parameter list
A variable declared within a class but outside of the class's methods
fully qualified name
A variable declared within a class but outside of the class's methods
value parameter
A variable declared within a class but outside of the class's methods
nonstatic method
A variable declared within a class but outside of the class's methods
local variable
A variable declared within a class but outside of the class's methods
calling method
A variable declared within a class but outside of the class's methods
field
A variable declared within a class but outside of the class's methods
bool
A variable declared within a class but outside of the class's methods
object's starting memory address
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
23
What are the components of a C# method?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
24
Every method has a(n) ____________________, indicating what kind of value the method will return to any other method that calls it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
25
You indicate that a method parameter is an array by placing ____ after the data type in the method's parameter list.

A) ()
B) $
C) []
D) {}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
26
The keyword static is used with Main() methods in console applications because the method is associated with its containing class and not with an object. Why are Form methods, such as a Click() method that responds to button clicks, nonstatic?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
27
You can tell a lot about a built-in method when you see how it is used. What can you tell about the built-in Pow() method (used to raise a number to a power) from the following statement?
double result = Math.Pow(2.0, 3.0);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
28
Describe how nested method calls work. For example, if you have three nested method calls, which method executes first and how are return values propagated? Is there a limit to how many method calls can be nested?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
29
If a method does not return a value, its return type is ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
30
A(n) ____________________ is an encapsulated series of statements that carry out a task.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
31
A method ____________________ is a block of statements that carry out the method's work.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
32
If you create a Click() method that responds to button clicks, it will be ____ by default because it is associated with an object that is a Form .

A) local
B) static
C) qualified
D) nonstatic
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
33
A method ____________________ defines the rules for using the method and can include accessibility, static, and return type modifiers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
34
A ____ statement causes a value to be sent back to the calling method.

A) break
B) result
C) return
D) continue
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
35
When you place a Button named okButton on a Form in the IDE and double-click it, a method is automatically generated with the following header: ____ okButton_Click( object sender, EventArgs e) .

A) public void
B) private void
C) static void
D) private int
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
36
When method calls are placed inside other method calls, the calls are ____ method calls.

A) nested
B) interleaved
C) cascaded
D) children
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
37
Write a DisplaySalesTax() method that receives the sales amount and tax rate as double s, and calculates and displays the sales tax. The method does not return a value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
38
When an array passed to a method is passed by ____, the method receives the actual memory address of the array and has access to the actual values in the array elements.

A) reference
B) value
C) output
D) input
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
39
For a method that accepts a parameter, what are the components of the parameter definition that must be included in the method declaration? Show an example of a method declaration with a parameter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
40
What are the two most common accessibility levels in C#?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
41
Explain how to write a Main() method that accepts parameters. Why might this format be used?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
42
When writing an event-handling method in a GUI application, what should you consider about a variable's scope?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.