1.
You are developing a method to hash data with the Secure Hash Algorithm. The data is passed to your method as a byte array named message. You need to compute the hash of the incoming parameter by using SHA1.
You also need to place the result into a byte array named hash. Which code segment should you use?
2.
You are developing an application that uses role-based security. The principal policy of the application domain is configured during startup with the following code. AppDomain.CurrentDomain.SetPrincipalPolicy(
_ PrincipalPolicy.WindowsPrincipal) You need to restrict access to
one of the methods in your application so that only members of the local Administrators group can call the method. Which attribute should you place on the method?
3.
You are developing a method to call a COM component. You need to use declarative security to explicitly request the runtime to perform a full stack walk. You must ensure that all callers have the required level of trust for COM interop before the callers execute your method. Which attribute should you place on the method?
4.
You are developing a method to hash data for later verification by using the MD5 algorithm. The data is passed to your method as a byte array named message. You need to compute the hash of the incoming parameter by using MD5. You also need to place the result into a byte array. Which code segment should you use?
5.
You are developing a method that searches a string for a substring. The method will be localized to Italy.
Your method accepts the following parameters:
The string to be searched, which is named SearchList
The string for which to search, which is named SearchValue
You need to write the code.
Which code segment should you use?
6.
You are developing an application for a client residing in Hong Kong. You need to display negative currency values by using a minus sign. Which code segment should you use?
7.
You need to generate a report that lists language codes and region codes. Which code segment should you use?
8.
You need to select a class that is optimized for key-based item retrieval from both small and large collections.
Which class should you choose?
9.
You are creating a class named Temperature. The Temperature class contains a public field named F. The public field F represents a temperature in degrees Fahrenheit. You need to ensure that users can specify whether a string representation of a Temperature instance displays the Fahrenheit value or the equivalent Celsius value. Which code segment should you use?
10.
You need to create a method to clear a Queue named q. Which code segment should you use?