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 that each value is appended to the Value property in the order that the Modify methods are invoked.
What should you do?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Q2. DRAG DROP - (Topic 1)
You are developing a class named ExtensionMethods.
You need to ensure that the ExtensionMethods class implements the IsEmail() 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 at all. You may need to drag the split bar between panes or scroll to view content.)
Answer:
Q3. - (Topic 2)
You are developing an application that generates code. The application includes the following code segment. (Line numbers are included for reference only.)
You need to ensure that code generated by the GenerateCode() method represents a class that can be accessed by all objects in its application domain.
Which two code segments can you insert at line 05 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
Answer: A,C
Q4. - (Topic 2)
An application is throwing unhandled NullReferenceException and FormatException errors. The stack trace shows that the exceptions occur in the GetWebResult() method.
The application includes the following code to parse XML data retrieved from a web service. (Line numbers are included for reference only.)
You need to handle the exceptions without interfering with the existing error-handling infrastructure.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Option A
B. Option B
C. Option C
D. Option D
Answer: A,C
Explanation: A: The TryParse method is like the Parse method, except the TryParse method does not throw an exception if the conversion fails. It eliminates the need to use exception handling to test for a FormatException in the event that s is invalid and cannot be successfully parsed.
C: UnhandledException event handler If the UnhandledException event is handled in the default application domain, it is raised there for any unhandled exception in any thread, no matter what application domain the thread started in. If the thread started in an application domain that has an event handler for UnhandledException, the event is raised in that application domain.
Q5. - (Topic 2)
You plan to store passwords in a Windows Azure SQL Database database.
You need to ensure that the passwords are stored in the database by using a hash algorithm,
Which cryptographic algorithm should you use?
A. ECDSA
B. RSA-768
C. AES-256
D. SHA-256
Answer: D
Q6. - (Topic 1)
You have the following code (line numbers are included for reference only):
You need to identify the missing line of code at line 15. Which line of code should you identify?
A. using (fooSqlConn.BeginTransaction())
B. while (fooSqlReader.Read())
C. while (fooSqlReader.NextResult())
D. while (fooSqlReader.GetBoolean(0))
Answer: B
Q7. - (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 .NET Framework in the registry.
C. Configure the Define DEBUG constant setting in Microsoft Visual Studio.
D. Decorate the code by using the [assembly:AssemblyDelaySignAttribute(true)] attribute.
Answer: C
Explanation: Use one debug version to connect to the development database, and a standard version to connect to the live database.
Q8. - (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 an unhandled exception.
What should you do?
A. Create a TaskCompletionSource<T> object and call the TrySetException() method of the object.
B. Create a task by calling the Task.ContinueWith() method.
C. Examine the Task.Status property immediately after the call to the Task.Run() method.
D. Create a task inside the existing Task.Run() method by using the AttachedToParent option.
Answer: B
Q9. - (Topic 2)
You need to write a method that retrieves data from a Microsoft Access 2013 database. The method must meet the following requirements:
Be read-only.
Be able to use the data before the entire data set is retrieved.
Minimize the amount of system overhead and the amount of memory usage.
Which type of object should you use in the method?
A. DbDataAdapter
B. unTyped DataSet
C. OleDbDataAdapter
D. DbDataReader
Answer: D
Explanation: The DbDataReader class reads a forward-only stream of rows from a data source.
Reference: DbDataReader Class
https://msdn.microsoft.com/en-us/library/system.data.common.dbdatareader(v=vs.110).aspx
Q10. - (Topic 2)
You are developing an assembly.
You plan to sign the assembly when the assembly is developed.
You need to reserve space in the assembly for the signature.
What should you do?
A. Run the Assembly Linker tool from the Windows Software Development Kit (Windows SDK).
B. Run the Strong Name tool from the Windows Software Development Kit (Windows SDK).
C. Add the AssemblySignatureKeyAttribute attribute the assembly.
D. Add the AssemblyDelaySignAttribute attribute to the assembly.
Answer: D
Q11. - (Topic 1)
You are developing an application that will process orders. The debug and release versions of the application will display different logo images.
You need to ensure that the correct image path is set based on the build configuration. Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: C
Explanation:
There is no such constraint (unless you define one explicitly) RELEASE. http://stackoverflow.com/questions/507704/will-if-release-work-like-if-debug-does-in-c
Q12. - (Topic 2)
You write the following method (line numbers are included for reference only):
You need to ensure that the method extracts a list of URLs that match the following pattern:
@http://(www\.)?([^\.]+)\.com;
Which code should you insert at line 07?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: A
Explanation: * MatchCollection Represents the set of successful matches found by iteratively applying a regular expression pattern to the input string. The collection is immutable (read-only) and has no public constructor. The Regex.Matches method returns a MatchCollection object.
* List<T>.Add Method Adds an object to the end of the List<T>. Incorrect: Not D: ICollection.SyncRoot Property For collections whose underlying store is not publicly available, the expected implementation is to return the current instance. Note that the pointer to the current instance might not be sufficient for collections that wrap other collections; those should return the underlying collection's SyncRoot property.
Q13. - (Topic 2)
You are developing an application that produces an executable named MyApp.exe and an assembly named MyApp.dll.
The application will be sold to several customers.
You need to ensure that enough debugging information is available for MyApp.exe, so that if the application throws an error in a customer's environment, you can debug the error in your own development environment.
What should you do?
A. Digitally sign MyApp.dll.
B. Produce program database (PDB) information when you compile the code.
C. Compile MyApp.exe by using the /unsafe compiler option.
D. Initializes a new instance of the AssemblyDelaySignAttribute class in the MyApp.dll constructor.
Answer: B
Q14. - (Topic 2)
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?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Explanation: When the C# compiler encounters an #if directive, followed eventually by an #endif directive, it will compile the code between the directives only if the specified symbol is defined. Unlike C and C++, you cannot assign a numeric value to a symbol; the #if statement in C# is Boolean and only tests whether the symbol has been defined or not. For example, #define DEBUG // ... #if DEBUG Console.WriteLine("Debug version"); #endif
Q15. DRAG DROP - (Topic 2)
You are developing a C# application. The application includes a class named Rate. The following code segment implements the Rate class:
You define a collection of rates named rateCollection by using the following code segment:
Collection<Rate> rateCollection = new Collection<Rate>() ;
The application receives an XML file that contains rate information in the following format:
You need to parse the XML file and populate the rateCollection collection with Rate objects.
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 in the answer area. 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.)
Answer: