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? 

A ArrayList ar = new ArrayList();
Process[] procs;
ProcessModuleCollection modules;
procs = Process.GetProcesses(@"Process1");
"A Composite Solution With Just One Click" - Certification Guaranteed 241 Microsoft 70-536 Exam
if (procs.Length > 0) {
modules = procs[0].Modules
foreach (ProcessModule mod in modules) {
ar.Add(mod.ModuleName);
}

B ArrayList ar = new ArrayList();
Process[] procs;
ProcessModuleCollection modules;
procs = Process.GetProcessesByName(@"Process1");
if (procs.Length > 0) {
modules = procs[0].Modules;
foreach (ProcessModule mod in modules) {
ar.Add(mod.FileName);
}

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

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

+ Answer
+ Report
Total Preview: 691

Copyright © 2024. Powered by Intellect Software Ltd