Exam 70-536 : .NET Framework Application Development Foundation Part – 2

Question: 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?

  1. MemoryStream inStream = new MemoryStream(document);
    GZipStream zipStream = new GZipStream(inStream, CompressionMode.Compress);
    byte[] result = new Byte[document.Length];
    zipStream.Write(result, 0, result.Length);
    return result;
  2. MemoryStream Stream = new MemoryStream(document);
    GZipStream zipStream = new GZipStream(stream, CompressionMode.Compress);
    zipStream.Write(document, 0, document.Length);
    zipStream.Close();
    return stream.ToArray();
  3. MemoryStream outStream = new MemoryStream();
    GZipStream zipStream = new GZipStream(outStream, CompressionMode.Compress);
    zipStream.Write(document, 0, document.Length);
    zipStream.Close();
    return outStream.ToArray();
  4. MemoryStream inStream = new MemoryStream(document);
    GZipStream zipStream = new GZipStream(inStream, CompressionMode.Compress);
    MemoryStream outStream = new MemoryStream();
    int b;
    while((b = zipStream.ReadByte()) != -1) {
    outStream.WriteByte((byte)b);
    }
    return outStream.ToArray();

Correct Answer: 3


Question: You develop a service application named FileService. You deploy the service application to multiple servers on your network. You implement the following code segment. (Line numbers are included for reference only.)
01 public void StartService(string serverName){
02 ServiceController crtl = new
03 ServiceController(“FileService”);
04 if (crtl.Status == ServiceControllerStatus.Stopped){
05 }
06 }
You need to develop a routine that will start FileService if it stops. The routine must start FileService on the server identified by the serverName input parameter. Which two lines of code should you add to the code segment? (Each correct answer presents part of the solution. Choose two.)

  1. Insert the following line of code between lines 03 and 04:
    crtl.ServiceName = serverName;
  2. Insert the following line of code between lines 03 and 04:
    crtl.MachineName = serverName;
  3. Insert the following line of code between lines 03 and 04:
    crtl.Site.Name = serverName;
  4. Insert the following line of code between lines 04 and 05:
    crtl.Continue();
  5. Insert the following line of code between lines 04 and 05:
    crtl.Start();
  6. Insert the following line of code between lines 04 and 05:
    crtl.ExecuteCommand(0);

Correct Answer: 2 & 5


Question: You are writing an application that uses isolated storage to store user preferences. The application uses multiple assemblies. Multiple users will use this application on the same computer. You need to create a directory named Preferences in the isolated storage area that is scoped to the current Microsoft Windows identity and assembly. Which code segment should you use?

  1. IsolatedStorageFile store;
    store = IsolatedStorageFile.GetUserStoreForAssembly();
    store.CreateDirectory("Preferences");
  2. IsolatedStorageFile store;
    store = IsolatedStorageFile.GetMachineStoreForAssembly();
    store.CreateDirectory("Preferences");
  3. IsolatedStorageFile store;
    store = IsolatedStorageFile.GetUserStoreForDomain();
    store.CreateDirectory("Preferences");
  4. IsolatedStorageFile store;
    store = IsolatedStorageFile.GetMachineStoreForApplication();
    store.CreateDirectory("Preferences");

Correct Answer: 1


Question: You need to write a multicast delegate that accepts a DateTime argument. Which code segment should you use?

  1. public delegate int PowerDeviceOn(bool result, DateTime autoPowerOff);
  2. public delegate bool PowerDeviceOn(object sender, EventsArgs autoPowerOff);
  3. public delegate void PowerDeviceOn(DataTime autoPowerOff);
  4. public delegate bool PowerDeviceOn(DataTime autoPowerOff);

Correct Answer: 3


Question: You develop a service application that needs to be deployed. Your network administrator creates a specific user account for your service application. You need to configure your service application to run in the context of this specific user account. What should you do?

  1. Prior to installation, set the StartType property of the ServiceInstaller class.
  2. Prior to installation, set the Account, Username, and Password properties of the ServiceProcessInstaller class.
  3. Use the CONFIG option of the net.exe command-line tool to install the service.
  4. Use the installutil.exe command-line tool to install the service.

Correct Answer: 2

Tagged . Bookmark the permalink.

Leave a Reply