Exam 8: Advanced Method Concepts
Exam 1: A First Program Using C42 Questions
Exam 2: Using Data42 Questions
Exam 3: Using Gui Objects and the Visual Studio Ide42 Questions
Exam 4: Making Decisions42 Questions
Exam 5: Looping42 Questions
Exam 6: Using Arrays42 Questions
Exam 7: Using Methods42 Questions
Exam 8: Advanced Method Concepts42 Questions
Exam 9: Using Classes and Objects42 Questions
Exam 10: Introduction to Inheritance42 Questions
Exam 11: Exception Handling42 Questions
Exam 12: Using Controls42 Questions
Exam 13: Handling Events41 Questions
Exam 14: Files and Streams42 Questions
Select questions type
When you use a(n) ____ parameter in a method header, you indicate the parameter's type and name, and the method receives a copy of the value passed to it.
Free
(Multiple Choice)
4.7/5
(28)
Correct Answer:
D
Only ____ parameters can be given default values.
Free
(Multiple Choice)
4.9/5
(48)
Correct Answer:
A
Any optional parameters in a parameter list must appear to the right of all ____ parameters in the list.
Free
(Multiple Choice)
4.8/5
(36)
Correct Answer:
B
Methods with identical names that have identical parameter lists but different return types are ____ methods.
(Multiple Choice)
4.8/5
(38)
You cannot use the out or ref keywords when passing an array to a method.
(True/False)
4.8/5
(35)
____ parameters act as aliases, or pseudonyms, for the same memory location occupied by the original variable being passed to a method.
(Multiple Choice)
4.8/5
(35)
When you use the Visual Studio ____________________ to create programs, the IntelliSense feature will allow you to discover built-in overloaded methods by displaying all versions of the method when you type in the method name and the parameter list opening parenthesis.
(Short Answer)
4.8/5
(35)
A method's name and parameter list constitute the method's ____.
(Multiple Choice)
4.8/5
(32)
What is programming principle is violated when using named arguments and why is this important?
(Essay)
4.7/5
(38)
When you use a reference parameter, any passed variable must have an assigned value.
(True/False)
5.0/5
(39)
To avoid data conversion exceptions that occur when a value cannot be converted to an appropriate type, you can use a version of the C# ____ method with an out parameter.
(Multiple Choice)
4.8/5
(32)
Given the following code, describe a situation that would make the code ambiguous to the C# compiler:
using static System.Console;
public class AmbiguousMethods
{
static void Main()
{
int iNum = 20;
double dNum = 4.5;
SimpleMethod(iNum, dNum); // calls first version
SimpleMethod(dNum, iNum); // calls second version
SimpleMethod(iNum, iNum); // error! Call is ambiguous.
}
private static void SimpleMethod( int i, double d)
{
WriteLine("Method receives int and double");
}
private static void SimpleMethod( double d, int i)
{
WriteLine("Method receives double and int ");
}
}
(Essay)
4.9/5
(36)
On occasion, you might want a method to be able to alter a value you pass to it. In that case, you can use a(n) ____ parameter or an output parameter.
(Multiple Choice)
4.9/5
(28)
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
(35)
Methods are ____ when there is the potential for a situation in which the compiler cannot determine which method to use.
(Multiple Choice)
4.9/5
(25)
A method can return at most one value to a method that calls it.
(True/False)
4.9/5
(34)
Match each item with a statement below:
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(41)
Showing 1 - 20 of 42
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)