Exam 8: Advanced Method Concepts
Exam 1: A First Program Using C#40 Questions
Exam 2: Using Data39 Questions
Exam 3: Using Gui Objects and the Visual Studio Ide40 Questions
Exam 5: Looping40 Questions
Exam 6: Using Arrays40 Questions
Exam 7: Using Methods39 Questions
Exam 8: Advanced Method Concepts39 Questions
Exam 9: Using Classes and Objects39 Questions
Exam 10: Introduction to Inheritance40 Questions
Exam 11: Exception Handling39 Questions
Exam 12: Using Controls40 Questions
Exam 13: Handling Events41 Questions
Exam 14: Files and Streams40 Questions
Exam 15: Making Decisions40 Questions
Select questions type
To ensure that the original value of an argument passed to a method remains unchanged after returning from the method, you should use a reference parameter or an output parameter.
Free
(True/False)
4.9/5
(33)
Correct Answer:
False
What modifier is used to indicate that a parameter is used for output?
Free
(Multiple Choice)
4.9/5
(26)
Correct Answer:
D
What Visual Studio IDE feature can be used to discover information about methods you are using?
Free
(Multiple Choice)
4.9/5
(37)
Correct Answer:
B
What type of parameter requires that the argument used to call the method must have an assigned value?
(Multiple Choice)
4.8/5
(40)
What is a method considered to be when there is a potential for a situation in which the compiler cannot determine what method to use?
(Multiple Choice)
4.8/5
(45)
Under what circumstances can you return a reference from a method?
(Multiple Choice)
4.9/5
(36)
You cannot use the out or ref keywords when passing an array to a method.
(True/False)
4.8/5
(36)
When naming an argument in a method call using its parameter name, what must come before the value?
(Multiple Choice)
4.8/5
(38)
When adding optional parameters in a parameter list, what is a valid requirement?
(Multiple Choice)
5.0/5
(41)
Given the following program, write the InputMethod() method.It should read two values from the user and assign them to the int variables first and second, which are then printed out in the code shown below.
using static System.Console;
class InputMethodDemo
{
static void Main()
{
int first, second;
InputMethod(out first, out second);
WriteLine("After InputMethod first is {0}", first);
WriteLine("and second is {0}", second);
}
}
(Essay)
4.9/5
(37)
Describe the similarities and differences among method versions when the method is overloaded.
(Essay)
4.8/5
(33)
A method can return at most one value to a method that calls it.
(True/False)
4.8/5
(38)
Given the following two method signatures, explain the reasoning behind how the C# compiler determines which method version to invoke for the call MyMethod(12):
private static void MyMethod(int a)
private static void MyMethod(int a, char b = 'B')
(Essay)
4.9/5
(40)
What is the difference between a reference parameter and an output parameter?
(Essay)
4.7/5
(30)
Suppose that you create overloaded method versions with the following declarations:
private static void MyMethod(double d)
private static void MyMethod(float f)
Would MyMethod() run if it is called with an integer argument? Describe how C# determines which, if either, method should run when MyMethod() is called.
(Essay)
4.9/5
(25)
Write the DisplayStrings() method called in the code below using a parameter array declared in the method header.The method should write its arguments in a single line, followed by a newline.What will the output be after running Main()?
using static System.Console;
class ParamsDemo
{
static void Main()
{
string[] names = {"Mark", "Paulette", "Carol"};
DisplayStrings("Ginger");
DisplayStrings("George", "Maria", "Thomas");
DisplayStrings(names);
}
}
(Essay)
4.9/5
(35)
When declaring a method, how any params keywords are permitted?
(Multiple Choice)
4.8/5
(37)
What should you utilize when you don't know how many arguments you might eventually send to a method?
(Multiple Choice)
4.9/5
(37)
Showing 1 - 20 of 39
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)