Microsoft Programming in C# - 070-483 Exam Practice Test

You are developing an application that will include a method named GetData. The GetData() method will retrieve several lines of data from a web service by using a System.IO.StreamReader object.
You have the following requirements:
* The GetData() method must return a string value that contains the first line of the response from the web service.
* The application must remain responsive while the GetData() method runs.
You need to implement the GetData() method.
How should you complete the relevant code? (To answer, drag the appropriate objects to the correct locations in the answer area. Each object 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.)
Correct Answer:

Explanation:
Box 1. async Box 2. await Box 3. ReadLineAsync();
Incorrect:
Not Box 3: ReadToEndAsync() is not correct since only the first line of the response is required.
You are developing a class named EmployeeRoster. The following code implements the EmployeeRoster class. (Line numbers are included for reference only.)

You create the following unit test method to test the EmployeeRoster class implementation:

You need to ensure that the unit test will pass.
What should you do?
Correct Answer: C Vote an answer
You have an assembly named Assembly named Assembly1 that is written in C#.
Your company plans to sell Assembly =1 to customers. The customers might debug Assembly1.
You need to minimize the amount of information contained within the debug symbols that are shipped with Assembly1.
How should you create the debug symbols for Assembly1?
Correct Answer: B Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
You are creating a console application named Appl.
App1 retrieves data from the Internet by using JavaScript Object Notation (JSON).
You are developing the following code segment (line numbers are included for reference only):

You need to ensure that the code validates the JSON string.
Which code should you insert at line 03?
Correct Answer: C Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
You are developing an application that will transmit large amounts of data between a client computer and a server. You need to ensure the validity of the data by using a cryptographic hashing algorithm. Which algorithm should you use?
Correct Answer: D Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
You are modifying an application that processes loans. The following code defines the Loan class. (Line numbers are included for reference only.)

Loans are restricted to a maximum term of 10 years. The application must send a notification message if a loan request exceeds 10 years.
You need to implement the notification mechanism.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
Correct Answer: A,C Vote an answer
You need to write a console application that meets the following requirements:
If the application is compiled in Debug mode, the console output must display Entering debug mode.
If the application is compiled in Release mode, the console output must display Entering release mode.
Which code should you use?
Correct Answer: A Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
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?
Correct Answer: B Vote an answer
You are creating a console application named Appl.
App1 retrieves data from the Internet by using JavaScript Object Notation (JSON).
You are developing the following code segment (line numbers are included for reference only):

You need to ensure that the code validates the JSON string.
Which code should you insert at line 03?
Correct Answer: A Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
You are testing an application. The application includes methods named CalculateInterest and LogLine. The CalculateInterest() method calculates loan interest. The LogLine() method sends diagnostic messages to a console window.
The following code implements the methods. (Line numbers are included for reference only.)

You have the following requirements:
* The Calculatelnterest() method must run for all build configurations.
* The LogLine() method must run only for debug builds.
You need to ensure that the methods run correctly.
What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
Correct Answer: A,E Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).
You are developing an application by using C#. The application will process several objects per second.
You need to create a performance counter to analyze the object processing.
Which three actions should you perform in sequence? (To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.)
Correct Answer:

1 - Create a CounterCreationDataCollection collection. Then create the counters as CounterCreationData objects and set the necessary properties.
2 - Add the CounterCreationData objects to the collection by calling the Add() method of the collection.
3 - Call the Create() method of the PerformanceCounterCategory class and pass the collection to the method.
Explanation:
Note:
Example:
CounterCreationDataCollection counterDataCollection = new CounterCreationDataCollection(); // Box1
// Add the counter. Box 1
CounterCreationData averageCount64 = new CounterCreationData();
averageCount64.CounterType = PerformanceCounterType.AverageCount64;
averageCount64.CounterName = "AverageCounter64Sample";
counterDataCollection.Add(averageCount64);
// Add the base counter.
CounterCreationData averageCount64Base = new CounterCreationData();
averageCount64Base.CounterType = PerformanceCounterType.AverageBase;
averageCount64Base.CounterName = "AverageCounter64SampleBase";
counterDataCollection.Add(averageCount64Base); // Box 2
// Create the category. Box 3
PerformanceCounterCategory.Create("AverageCounter64SampleCategory",
"Demonstrates usage of the AverageCounter64 performance counter type.", PerformanceCounterCategoryType.SingleInstance, counterDataCollection);
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?
Correct Answer: C Vote an answer
Explanation: Only visible for PassTestking members. You can sign-up / login (it's free).