Q1. - (Topic 2) You are developing an application that uses a .config file. The relevant portion of the .config file is shown as follows: You need to ensure that diagnostic data for the application writes to the event log by using the configuration specified in the .config file. What should you include in the application code? A. Option A B. Option B C. Option C D. Option…
Q1. - (Topic 2) 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? A. 01 B.…
Q1. - (Topic 1) You use the Task.Run() method to launch a long-running data processing operation. The data processing operation often fails in times of heavy network congestion. If the data processing operation fails, a second operation must clean up any results of the first operation. You need to ensure that the second operation is invoked only if the data processing operation throws…
Q1. DRAG DROP - (Topic 1) 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 entire response from the web service. . The application must…
Q1. - (Topic 1) 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…
Q1. - (Topic 1) You are creating a console application by using C#. You need to access the assembly found in the file named car.dll. Which code segment should you use? A. Assembly.Load(); B. Assembly.GetExecutingAssembly(); C. This.GetType(); D. Assembly.LoadFile("car.dll"); View AnswerAnswer: D Explanation: Assembly.LoadFile - Loads the contents of an assembly file on the specified path. http://msdn.microsoft.com/en-us/library/b61s44e8.aspx Q2. - (Topic 2) You are developing an application that includes a class named Employee…
Q1. DRAG DROP - (Topic 1) You develop an application that displays information from log files when errors occur. The application will prompt the user to create an error report that sends details about the error and the session to the administrator. When a user opens a log file by using the application, the application throws an exception and closes. The application must…
Q1. DRAG DROP - (Topic 2) You create an assembly named Assembly1.dll. You need to ensure that Assembly1.dll can be deployed to the global assembly cache (GAC). Which commands should you run? (To answer, drag the appropriate programs to the correct locations. Each program may be used once, more than once, or not at all. You may need to drag the split bar…
Q1. - (Topic 2) 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 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…
Q1. - (Topic 1) You are creating an application that manages information about your company's products. The application includes a class named Product and a method named Save. The Save() method must be strongly typed. It must allow only types inherited from the Product class that use a constructor that accepts no parameters. You need to implement the Save() method. Which code segment…
Q1. - (Topic 1) 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 not throw any exceptions when converting the obj object to the IDataContainer interface or when accessing the Data property. You need to meet the requirements. Which code segment should you insert at line…
Q1. DRAG DROP - (Topic 1) You are developing a class named ExtensionMethods. You need to ensure that the ExtensionMethods class implements the IsEmail() extension method on string objects. How should you complete the relevant code? (To answer, drag the appropriate code segments to the correct locations in the answer area. Each code segment may be used once, more than once, or not…
Q1. - (Topic 2) You are developing a class named Scorecard. The following code implements the Scorecard class. (Line numbers are included for reference only.) You create the following unit test method to test the Scorecard class implementation: You need to ensure that the unit test will pass. What should you do? A. Option A B. Option B C. Option C D. Option D View AnswerAnswer: A Q2. -…
Q1. - (Topic 2) You are creating an application that reads from a database. You need to use different databases during the development phase and the testing phase by using conditional compilation techniques. What should you do? A. Configure the assembly metadata to use the pre-existing public key for the assembly identity by using the AssemblySignatureKeyAttribute attribute. B. Disable the strong-name bypass feature of Microsoft…
Q1. - (Topic 2) 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 'inf. An explicit conversion exists (are you missing a cast?)." You need to ensure that the code can be compiled. Which code should you use…
Q1. - (Topic 2) 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…
Q1. - (Topic 1) You are debugging an application that calculates loan interest. The application includes the following code. (Line numbers are included for reference only.) You need to ensure that the debugger breaks execution within the CalculateInterest() method when the loanAmount variable is less than or equal to zero in all builds of the application. What should you do? A. Insert the following…
Q1. - (Topic 1) You are developing a C# application that includes a class named Product. The following code segment defines the Product class: You implement System.ComponentModel.DataAnnotations.IValidateableObject interface to provide a way to validate the Product object. The Product object has the following requirements: . The Id property must have a value greater than zero. . The Name property must have a value other than…
Q1. - (Topic 1) You are developing an application by using C#. The application includes an object that performs a long running process. You need to ensure that the garbage collector does not release the object's resources until the process completes. Which garbage collector method should you use? A. RemoveMemoryPressure() B. ReRegisterForFinalize() C. WaitForFullGCComplete() D. KeepAlive() View AnswerAnswer: D Q2. - (Topic 2) You are developing a C# application. The application includes…
Q1. HOTSPOT - (Topic 1) You are developing an application that includes a Windows Communication Foundation (WCF) service. The service includes a custom TraceSource object named ts and a method named DoWork. The application must meet the following requirements: . Collect trace information when the DoWork() method executes. . Group all traces for a single execution of the DoWork() method as an…
Q1. - (Topic 2) You have the following code. (Line numbers are included for reference only.) When you execute the code, you get an exception. You need to ensure that B_Products contain all of the products that start with the letter “B”. What should you do? A. Option A B. Option B C. Option C D. Option D View AnswerAnswer: D Explanation: Simply select the product items. Q2. DRAG DROP…
Q1. DRAG DROP - (Topic 1) You are implementing a method that creates an instance of a class named User. The User class contains a public event named Renamed. The following code segment defines the Renamed event: Public event EventHandler Renamed; You need to create an event handler for the Renamed event by using a lambda expression. How should you complete the relevant code?…
Q1. - (Topic 1) You are adding a public method named UpdateGrade to a public class named ReportCard. The code region that updates the grade field must meet the following requirements: . It must be accessed by only one thread at a time. . It must not be vulnerable to a deadlock situation. You need to implement the UpdateGrade() method. What should you…
Q1. DRAG DROP - (Topic 1) You are developing an application that implements a set of custom exception types. You declare the custom exception types by using the following code segments: The application includes a function named DoWork that throws .NET Framework exceptions and custom exceptions. The application contains only the following logging methods: The application must meet the following requirements: . When ContosoValidationException…
Q1. DRAG DROP - (Topic 1) 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…
Q1. - (Topic 1) You are developing an application that includes a class named BookTracker for tracking library books. The application includes the following code segment. (Line numbers are included for reference only.) You need to add a book to the BookTracker instance. What should you do? A. Option A B. Option B C. Option C D. Option D View AnswerAnswer: A Q2. - (Topic 2) You have the…
Q1. HOTSPOT - (Topic 1) You are reviewing the following code: For each of the following statements, select Yes if the statement is true. Otherwise, select No. View AnswerAnswer: Q2. - (Topic 2) 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…
Q1. - (Topic 1) You are creating a console application by using C#. You need to access the application assembly. Which code segment should you use? A. Assembly.GetAssembly(this); B. this.GetType(); C. Assembly.Load(); D. Assembly.GetExecutingAssembly(); View AnswerAnswer: D Explanation: Assembly.GetExecutingAssembly - Gets the assembly that contains the code that is currently executing. http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getexecutingassembly(v=vs.110).aspx Assembly.GetAssembly - Gets the currently loaded assembly in which the specified class is defined. http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getassembly.aspx Q2. - (Topic 2) You are…
Q1. - (Topic 1) You are creating a class named Game. The Game class must meet the following requirements: Include a member that represents the score for a Game instance. Allow external code to assign a value to the score member. Restrict the range of values that can be assigned to the score member. You need to implement the score member to meet the requirements. In which…
Q1. - (Topic 2) You have the following code: You need to retrieve all of the numbers from the items variable that are greater than 80. Which code should you use? A. Option A B. Option B C. Option C D. Option D View AnswerAnswer: A Q2. - (Topic 2) You are developing an application. The application contains the following code segment (line numbers are included for reference only): When you…
Q1. - (Topic 1) You are debugging an application that calculates loan interest. The application includes the following code. (Line numbers are included for reference only.) You have the following requirements: . The debugger must break execution within the Calculatelnterest() method when the loanAmount variable is less than or equal to zero. . The release version of the code must not be impacted…
Q1. - (Topic 2) 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: 312 231 You need to ensure…
Q1. - (Topic 2) 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.) A. Option A B. Option B C. Option C D. Option D View AnswerAnswer: C,D Explanation: D: ExpandoObject Represents an…
Q1. - (Topic 2) 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…
Q1. - (Topic 1) You are developing an application that uses structured exception handling. The application includes a class named ExceptionLogger. The ExceptionLogger class implements a method named LogException by using the following code segment: public static void LogException(Exception ex) You have the following requirements: . Log all exceptions by using the LogException() method of the ExceptionLogger class. . Rethrow the original exception, including…
Q1. - (Topic 1) You are developing an application by using C#. The application includes an object that performs a long running process. You need to ensure that the garbage collector does not release the object's resources until the process completes. Which garbage collector method should you use? A. WaitForFullGCComplete() B. WaitForFullGCApproach() C. KeepAlive() D. WaitForPendingFinalizers() View AnswerAnswer: C Explanation: The GC.KeepAlive method references the specified object, which makes it ineligible…