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

Question: You are testing a method that examines a running process. This method returns an ArrayList containing the name and full path of all modules that are loaded by the process. You need to list the modules loaded by a process named C:\TestApps\Process1.exe. Which code segment should you use?

  1. ArrayList ar = new ArrayList();
    Process[] procs;
    ProcessModuleCollection modules;
    procs = Process.GetProcesses(@"Process1");
    if (procs.Length > 0) {modules = porcs[0].Modules;
    foreach (ProcessModule mod in modules) {
    ar.Add(mod.ModuleName);
    }}
  2. ArrayList ar = new ArrayList();
    Process[] procs;
    ProcessModuleCollection modules;
    procs = Process.GetProcesses(@"C:\TestApps\Process1.exe");
    if (procs.Length > 0) {modules = porcs[0].Modules;
    foreach (ProcessModule mod in modules) {
    ar.Add(mod.ModuleName);
    }}
  3. ArrayList ar = new ArrayList();
    Process[] procs;
    ProcessModuleCollection modules;
    procs = Process.GetProcessesByName(@"Process1");
    if (procs.Length > 0) {
    modules = porcs[0].Modules;
    foreach (ProcessModule mod in modules) {
    ar.Add(mod.FileName);
    }}
  4. ArrayList ar = new ArrayList();
    Process[] procs;
    ProcessModuleCollection modules;
    procs = Process.GetProcessesByName(@"C:\TestApps\Process1.exe");
    if(procs.Length > 0) {
    modules = porcs[0].Modules;
    foreach (ProcessModule mod in modules) {
    ar.Add(mod.FileName);
    }}

Correct Answer: 3


Question: You are creating a strong-named assembly named Company1 that will be used in multiple applications. Company1 will be rebuilt frequently during the development cycle. You need to ensure that each time the assembly is rebuilt it works correctly with each application that uses it. You need to configure the computer on which you develop Company1 such that each application uses the latest build of Company1. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

  1. Create a DEVPATH environment variable that points to the build output directory for the strong-named assembly.
  2. Add the following XML element to the machine configuration file:
    <developmentMode developerInstallation="true"/>
  3. Add the following XML element to the machine configuration file:
    <dependentAssembly>
    <assemblyIdentity name="Company1" publicKeyToken="32ab4ba45e0a69a1" language="en-US" version="*.*.*.*" />
    <publisherPolicy apply="no" />
    </dependentAssembly>
  4. Add the following XML element to the configuration file of each application that
    uses the strong-named assembly:
    <supportedRuntime version="*.*.*.*" />
  5. Add the following XML element to the configuration file of each application that
    uses the strong-named assembly:
    <dependentAssembly>
    <assemblyIdentity name="Company1" publicKeyToken="32ab4ba45e0a69a1" language="en-US" version="*.*.*.*" />
    <bindingRedirect newVersion="*.*.*.*"/>
    </dependentAssembly>

Correct Answer: 1 & 2


Question: You are developing an application that receives events asynchronously. You create a WqlEventQuery instance to specify the events and event conditions to which the application must respond. You also create a ManagementEventWatcher instance to subscribe to events matching the query. You need to identify the other actions you must perform before the application can receive events asynchronously. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

  1. Start listening for events by calling the Start method of the ManagementEventWatcher.
  2. Set up a listener for events by using the EventArrived event of the ManagementEventWatcher.
  3. Use the WaitForNextEvent method of the ManagementEventWatcher to wait for the events.
  4. Create an event handler class that has a method that receives an ObjectReadyEventArgs parameter.
  5. Set up a listener for events by using the Stopped event of the ManagementEventWatcher.

Correct Answer: 1 & 2


Question: You are working on a debug build of an application. You need to find the line of code that caused an exception to be thrown. Which property of the Exception class should you use to achieve this goal?

  1. Data
  2. Message
  3. StackTrace
  4. Source

Correct Answer: 3


Question: You need to write a code segment that performs the following tasks:

    • Retrieves the name of each paused service.
      Passes the name to the Add method of Collection1.

Which code segment should you use?

  1. ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * from Win32_Service where State = 'Paused'");
    foreach (ManagementObject svc in searcher.Get()) {
    Collection1.Add(svc["DisplayName"]);
    }
  2. ManagementObjectSearcher searcher = new ManagementObjectSearcher( "Select * from Win32_Service", "State = 'Paused'");
    foreach (ManagementObject svc in searcher.Get()) {
    Collection1.Add(svc["DisplayName"]);
    }
  3. ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * from Win32_Service");
    foreach (ManagemetnObject svc in searcher.Get()) {
    if ((string) svc["State"] == "'Paused'") {
    Collection1.Add(svc["DisplayName"]);
    }
    }
  4. ManagementObjectSearcher searcher = new ManagementObjectSearcher();
    searcher.Scope = new ManagementScope("Win32_Service");
    foreach (ManagementObject svc in searcher.Get()) {
    if ((string)svc["State"] == "Paused") {
    Collection1.Add(svc["DisplayName"]);
    }
    }

Correct Answer: 1

Tagged . Bookmark the permalink.

Leave a Reply