1.
You are developing an auditing application to display the trusted ClickOnce applications that are installed on a computer. You need the auditing application to display the origin of each trusted application. Which code segment should you use?
2.
You are writing code for user authentication and authorization. The username, password, and roles are stored in your application data store. You need to establish a user security context that will be used for authorization checks such as IsInRole. You write the following code segment to authorize the user. if (!TestPassword(userName, password)) throw new Exception("could not authenticate user"); String[] userRolesArray = LookupUserRoles(userName); You need to complete this code so that it establishes the user security context. Which code segment should you use?
3.
You are creating an assembly named Assembly1. Assembly1 contains a public method. The global cache contains a second assembly named Assembly2. You must ensure that the public method is only called from Assembly2. Which permission class should you use?
4.
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?
5.
You are developing an application that will deploy by using ClickOnce. You need to test if the application executes properly. You need to write a method that returns the object, which prompts the user to install a ClickOnce application. Which code segment should you use?
6.
You create a DirectorySecurity object for the working directory. You need to identify the user accounts and groups that have read and write permissions. Which method should you use on the DirectorySecurity object?

 
7.
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?
8.
You are changing the security settings of a file named MyData.xml. You need to preserve the existing inherited access rules. You also need to prevent the access rules from inheriting changes in the future. Which code segment should you use?
9.
You are developing an application that runs by using the credentials of the end user. Only users who are members of the Administrator group get permission to run the application. You write the following security code to protect sensitive data within the application.
bool isAdmin = false;
WindowsBuiltInRole role = WindowsBuiltInRole.Administrator; ...
if (!isAdmin)
throw new Exception("User not permitted");
You need to add a code segment to this security code to ensure that the application throws an exception if a user is not a member of the Administrator group. Which code segment should you use?
10.
You are developing an application that will use custom authentication and role-based security. You need to write a code segment to make the runtime assign an unauthenticated principal object to each running thread. Which code segment should you use?