You create an application that stores information about your customers who reside in various regions. You are developing internal utilities for this application. You need to gather regional information about your customers in Canada. Which code segment should you use?
You are developing a server application that will transmit sensitive information on a network. You create an X509Certificate object named certificate and a TcpClient object named client. You need to create an SslStream to communicate by using the Transport Layer Security 1.0 protocol. Which code segment should you use?
You are writing a method that accepts a string parameter named message. Your method must break the message parameter into individual lines of text and pass each line to a second method named Process. Which code segment should you use?
You are creating a new security policy for an application domain. You write the following lines of code.
PolicyLevel policy = PolicyLevel.CreateAppDomainLevel();
PolicyStatement noTrustStatement = new PolicyStatement(policy.
GetNamedPermissionSet(Nothing));
PolicyStatement fullTrustStatement = new PolicyStatement(policy.
GetNamedPermissionSet(FullTrust));
You need to arrange code groups for the policy so that loaded assemblies default to the Nothing permission set. If the assembly originates from a trusted zone, the security policy must grant the assembly the FullTrust permission set. Which code segment should you use?
You develop a service application named PollingService that periodically calls long-running procedures. These procedures are called from the DoWork method. You use the following service application code: partial class PollingService : ServiceBase
{
bool blnExit = false;
public PollingService() {}
protected override void OnStart(string[] args)
{
do { DoWork();} while (!blnExit);
}
protected override void OnStop() { blnExit = true; }
private void DoWork() { ...}
}
When you attempt to start the service, you receive the following error message: Could not start the PollingService service on the local computer. Error 1053: The service did not respond to the start or control request in a timely fashion. You need to modify the service application code so that the service starts properly. What should you do?
You need to write a code segment that transfers the contents of a byte array named dataToSend by using a NetworkStream object named netStream. You need to use a cache of size 8,192 bytes. Which code segment should you use?
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:
You are writing a method to compress an array of bytes. The bytes to be compressed are passed to the method in a parameter named document. You need to compress the contents of the incoming parameter. Which code segment should you use?
You write the following code to call a function from the Win32 Application Programming Interface (API) by using platform invoke. int rc = MessageBox(hWnd, text, caption, type); You need to define a method prototype. Which code segment should you use?