Microsoft Programming in C# (070-483) Free Practice Test
Question 1
You are developing an application that includes a class named Customer.
The application will output the Customer class as a structured XML document by using the following code segment:

You need to ensure that the Customer class will serialize to XML.
You have the following code:

Which code segments should you include in Target 1, Target 2, Target 3 and Target 4 to complete the code? To answer, drag the appropriate code segments to the correct targets. 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.

The application will output the Customer class as a structured XML document by using the following code segment:

You need to ensure that the Customer class will serialize to XML.
You have the following code:

Which code segments should you include in Target 1, Target 2, Target 3 and Target 4 to complete the code? To answer, drag the appropriate code segments to the correct targets. 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.

Correct Answer:

Question 2
You are developing an application by using C#. The application will output the text string "First Line" followed by the text string "Second Line".
You need to ensure that an empty line separates the text strings.
Which four code segments should you use in sequence? (To answer, move the appropriate code segments to the answer area and arrange them in the correct order.)

You need to ensure that an empty line separates the text strings.
Which four code segments should you use in sequence? (To answer, move the appropriate code segments to the answer area and arrange them in the correct order.)

Correct Answer:

Question 3
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 CalculateInterest() 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.)
The following code implements the methods. (Line numbers are included for reference only.)

You have the following requirements:
* The CalculateInterest() 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: C,E
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 4
You are implementing a method named ProcessData that performs a long-running task. The ProcessData() method has the following method signature:
public void ProcessData(List<decimal> values, CancellationTokenSource source, CancellationToken token) If the calling code requests cancellation, the method must perform the following actions:
Cancel the long-running task.
Set the task status to TaskStatus.Canceled.
You need to ensure that the ProcessData() method performs the required actions.
Which code segment should you use in the method body?
public void ProcessData(List<decimal> values, CancellationTokenSource source, CancellationToken token) If the calling code requests cancellation, the method must perform the following actions:
Cancel the long-running task.
Set the task status to TaskStatus.Canceled.
You need to ensure that the ProcessData() method performs the required actions.
Which code segment should you use in the method body?
Correct Answer: A
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 5
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.)
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.)
Correct Answer: A,D
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 6
You are developing an application that includes the following code segment:

You need to implement the Open() method of each interface in a derived class named UseResources and call the Open() method of each interface.
Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)


You need to implement the Open() method of each interface in a derived class named UseResources and call the Open() method of each interface.
Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)

Correct Answer: B,C
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 7
You have the following code. (Line numbers are included for reference only).

You need to complete the WriteTextAsync method. The solution must ensure that the code is not blocked while the file is being written.
Which code should you insert at line 12?


You need to complete the WriteTextAsync method. The solution must ensure that the code is not blocked while the file is being written.
Which code should you insert at line 12?

Correct Answer: A
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 8
You are developing an application in C#.
You need to create an anonymous method.
You write the following code segment.

How should you complete the code? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.

You need to create an anonymous method.
You write the following code segment.

How should you complete the code? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.

Correct Answer:

Explanation:
Target 1: delegate
Target 2: void
Target 3: delegate