You are testing a method that examines a running process.

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”);if (procs.Length > 0) {modules = porcs[0].Modules;
    foreach (ProcessModule mod in modules) {
    ar.Add(mod.ModuleName);
    }}
B. 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);
    }}
C. 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);
    }}
D. 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);
    }}


Answer: C 

No comments:

Post a Comment