1.
You are implementing a method named ProcessReports that performs a long-running task. The ProcessReports() method has the following method signature: public void ProcessReports(List values,CancellationTokenSource cts, CancellationToken ct) 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 ProcessReports() method performs the required actions. Which code segment should you use in the method body?
2.
You are developing an application. You need to declare a delegate for a method that accepts an integer as a parameter, and then returns an integer. Which type of delegate should you use?
3.
You are writing the following method (line numbers are included for reference only): You need to ensure that CreateObject compiles successfully. What should you do?
4.
You are developing an application that includes the following code segment. (Line numbers are included for reference only.) You need to ensure that the DoWork(Widget widget) method runs. With which code segment should you replace line 24?
5.
You are developing an application that will parse a large amount of text. You need to parse the text into separate lines and minimize memory use while processing data. Which object type should you use?
6.
You are developing code for an application that retrieves information about Microsoft .NET Framework assemblies. The following code segment is part of the application (line numbers are included for reference only): You need to insert code at line 04. The code must load the assembly. Once the assembly is loaded, the code must be able to read the assembly metadata, but the code must be denied access from executing code from the assembly. Which code segment should you insert at line 04?
7.
You need to create a method that can be called by using a varying number of parameters. What should you use?
8.
You are developing an application. The application contains the following code segment (line numbers are included for reference only): When you run the code, you receive the following error message: "Cannot implicitly convert type 'object' to 'int'. An explicit conversion exists (are you missing a cast?)." You need to ensure that the code can be compiled. Which code should you use to replace line 05?
9.
You are creating a class library that will be used in a web application. You need to ensure that the class library assembly is strongly named. What should you do?
10.
You need to store the values in a collection. The solution must meet the following requirements: The values must be stored in the order that they were added to the collection. The values must be accessed in a first-in, first-out order. Which type of collection should you use?