070-483 無料問題集「Microsoft Programming in C#」
You are creating an application that manages information about zoo animals. The application includes a class named Animal and a method named Save.
The Save() method must be strongly typed. It must allow only types inherited from the Animal class that uses a constructor that accepts no parameters.
You need to implement the Save() method.
Which code segment should you use?

The Save() method must be strongly typed. It must allow only types inherited from the Animal class that uses a constructor that accepts no parameters.
You need to implement the Save() method.
Which code segment should you use?

正解:C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You have the following class (line numbers are included for reference only):

ServiceProxy is a proxy for a web service. Calls to the Update method can take up to five seconds. The Test class is the only class the uses Class1.
You run the Execute method three times, and you receive the following results:
213
312
231
You need to ensure that each value is appended to the Value property in the order that the Modify methods are invoked.
What should you do?


ServiceProxy is a proxy for a web service. Calls to the Update method can take up to five seconds. The Test class is the only class the uses Class1.
You run the Execute method three times, and you receive the following results:
213
312
231
You need to ensure that each value is appended to the Value property in the order that the Modify methods are invoked.
What should you do?

正解:B
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You have the following code.

You need to deserialize the stream1 parameter into the CompanyInfo class.
How should you complete the code?


You need to deserialize the stream1 parameter into the CompanyInfo class.
How should you complete the code?

正解:

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 need to declare a delegate to support the ProcessLoan() method.
Which code segment should you use?

正解:C
解答を投票する
You are developing an application that includes a class named Warehouse. The Warehouse class includes a static property named Inventory- The Warehouse class is defined by the following code segment. (Line numbers are included for reference only.)

You have the following requirements:
* Initialize the _inventory field to an Inventory instance.
* Initialize the _inventory field only once.
* Ensure that the application code acquires a lock only when the _inventory object must be instantiated.
You need to meet the requirements.
Which three code segments should you insert in sequence at line 09? (To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order.)


You have the following requirements:
* Initialize the _inventory field to an Inventory instance.
* Initialize the _inventory field only once.
* Ensure that the application code acquires a lock only when the _inventory object must be instantiated.
You need to meet the requirements.
Which three code segments should you insert in sequence at line 09? (To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order.)

正解:

1 - if (_inventory == null)
2 - lock (_lock)
3 - if (_inventory == null) _inventory = new Inventory ( ) ;
Explanation:
After taking a lock you must check once again the _inventory field to be sure that other threads didn't instantiated it in the meantime.
First, you check if the inventory is null, if so, you lock it to avoid other threads to change it.
Second, you check again for the null, as in the tiny millisecond between check for null and locking could another thread get it.
Finally you create the instance and release the lock.
You are developing an application that uses several objects. The application includes the following code segment. (Line numbers are included for reference only.)

You need to evaluate whether an object is null.
Which code segment should you insert at line 03?


You need to evaluate whether an object is null.
Which code segment should you insert at line 03?

正解:A
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You are developing an application by using C#. The application includes the following code segment. (Line numbers are included for reference only.)

The DoWork() method must throw an InvalidCastException exception if the obj object is not of type IDataContainer when accessing the Data property.
You need to meet the requirements. Which code segment should you insert at line 07?

The DoWork() method must throw an InvalidCastException exception if the obj object is not of type IDataContainer when accessing the Data property.
You need to meet the requirements. Which code segment should you insert at line 07?
正解:C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
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.)

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.)

正解:B、C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You are evaluating a method that calculates loan interest. The application includes the following code segment. (Line numbers are included for reference only.)

When the loanTerm value is 5 and the loanAmount value is 4500, the loanRate must be set to 6.5 percent.
You need to adjust the loanRate value to meet the requirements.
What should you do?

When the loanTerm value is 5 and the loanAmount value is 4500, the loanRate must be set to 6.5 percent.
You need to adjust the loanRate value to meet the requirements.
What should you do?
正解:D
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You are developing an application that includes a method named SendMessage.
You need to ensure that the SendMessage() method is called with the required parameters.
Which two code segments can you use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

You need to ensure that the SendMessage() method is called with the required parameters.
Which two code segments can you use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

正解:A、C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You have a List object that is generated by executing the following code:

You have a method that contains the following code (line numbers are included for reference only):

You need to alter the method to use a lambda statement.
How should you rewrite lines 03 through 06 of the method?


You have a method that contains the following code (line numbers are included for reference only):

You need to alter the method to use a lambda statement.
How should you rewrite lines 03 through 06 of the method?

正解:C
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
You are developing an application that retrieves patient data from a web service. The application stores the JSON messages returned from the web service in a string variable named PatientAsJson. The variable is encoded as UTF-8. The application includes a class named Patient that is defined by the following code:

You need to populate the Patient class with the data returned from the web service.
Which code segment should you use?


You need to populate the Patient class with the data returned from the web service.
Which code segment should you use?

正解:D
解答を投票する
You have the following code (line numbers are included for reference only):

You need to ensure that new instances of Connection can be created only by other classes by calling the Create method. The solution must allow classes to inherit from Connection.
What should you do?


You need to ensure that new instances of Connection can be created only by other classes by calling the Create method. The solution must allow classes to inherit from Connection.
What should you do?

正解:B
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)