070-483試験無料問題集「Microsoft Programming in C# 認定」

You are developing an application for a bank. The application includes a method named ProcessLoan that processes loan applications. The ProcessLoan() method uses a method named CalculateInterest. The application includes the following code:

You need to declare a delegate to support the ProcessLoan() method.
Which code segment should you use?

You are developing an application by using C#. The application includes a method named SendMessage. The SendMessage() method requires a string input.
You need to replace "Hello" with "Goodbye" in the parameter that is passed to the SendMessage() method.
Which two code segments can you use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

解説: (GoShiken メンバーにのみ表示されます)
You are developing an application.
The application contains the following code:

When you compile the code, you receive the following syntax error message: "A previous catch clause already catches all exceptions of this or a super type ('System.Exception')." You need to ensure that the code can be compiled. What should you do?

You have the following class. (Line numbers are included for reference only.)

You need to complete the doOperation method to meet the following requirements:
* If AddNumb is passed as the operationName parameter, the AddNumb function is called.
* If SubNumb is passed as the operationName parameter, the SubNumb function is called.
Which code should you insert at line 16? Develop the solution by selecting and arranging the required code blocks in the correct order. You may not need all of the code blocks.
正解:

Explanation:
Note:
* target 2:
GetType() is a method you call on individual objects, to get the execution-time type of the object.
Incorrect: typeof is an operator to obtain a type known at compile-time (or at least a generic type parameter). The operand of typeof is always the name of a type or type parameter - never an expression with a value (e.g. a variable). See the C# language specification for more details.
Reference:
http://stackoverflow.com/questions/11312111/when-and-where-to-use-gettype-or-typeof
You need to write a method that combines an unknown number of strings. The solution must minimize the amount of memory used by the method when the method executes.
What should you include in the code?

解説: (GoShiken メンバーにのみ表示されます)
You have the following code:

You need to display all of the vehicles that start with the letter "A".
How should you complete the code? To answer, drag the appropriate code elements to the correct targets. Each code element may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
NOTE: Each correct selection is worth one point.
正解:
You are troubleshooting an application that uses a class named FullName. The class is decorated with the DataContractAttribute attribute. The application includes the following code. (Line numbers are included for reference only.)

You need to ensure that the entire FullName object is serialized to the memory stream object.
Which code segment should you insert at line 09?

解説: (GoShiken メンバーにのみ表示されます)
You are developing an application that includes methods named ConvertAmount and TransferFunds.
You need to ensure that the precision and range of the value in the amount variable is not lost when the TransferFunds() method is called.
Which code segment should you use?

解説: (GoShiken メンバーにのみ表示されます)
You are developing an application in C#.
The application uses exception handling on a method that is used to execute mathematical calculations by using integer numbers.
You write the following catch blocks for the method (line numbers are included for reference only):

You need to add the following code to the method:

At which line should you insert the code?

You are developing a class named Temperature.
You need to ensure that collections of Temperature objects are sortable.
You have the following code:

Which code segments should you include in Target 1, Target 2 and Target 3 to complete the code? (To answer, drag the appropriate code segments to the correct targets in the answer area. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
正解:

Explanation:
Note:
Target 1:
The role of IComparable is to provide a method of comparing two objects of a particular type. This is necessary if you want to provide any ordering capability for your object.
Incorrect: The role of IComparer is to provide additional comparison mechanisms. For example, you may want to provide ordering of your class on several fields or properties, ascending and descending order on the same field, or both.
Target 2, Target 3:
Example:
// Implement IComparable CompareTo method - provide default sort order.
int IComparable.CompareTo(object obj)
{
car c=(car)obj;
return String.Compare(this.make,c.make);
}
Reference:
https://support.microsoft.com/en-us/kb/320727
You are implementing a new method named ProcessData. The ProcessData() method calls a third-party component that performs a long-running operation to retrieve stock information from a web service.
The third party component uses the IAsyncRcsult pattern to signal completion of the long-running operation so that the UI can be updated with the new values.
You need to ensure that the calling code handles the long-running operation as a 5ystem.Threading_Tasks.Task object to avoid blocking the Ul thread.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

You are modifying an existing application that manages employee payroll. The application includes a class named PayrollProcessor. The PayrollProcessor class connects to a payroll database and processes batches of paychecks once a week.
You need to ensure that the PayrollProcessor class supports iteration and releases database connections after the batch processing completes.
Which two interfaces should you implement? (Each correct answer presents part of the complete solution. Choose two.)

解説: (GoShiken メンバーにのみ表示されます)
You are developing an application that uses structured exception handling. The application includes a class named Logger. The Logger class implements a method named Log by using the following code segment:
public static void Log(Exception ex) { }
You have the following requirements:
* Log all exceptions by using the Log() method of the Logger class.
* Rethrow the original exception, including the entire exception stack.
You need to meet the requirements. Which code segment should you use?