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 = gcnew ArrayList();array<Process^> procs;ProcessModuleCollection^     
    modules;procs = Process::GetProcesses(@”Process1”);if(procs->Length > 0) {
    modules = procs[0]->Modules;
    for each (ProcessModule^ mod in modules) {
    ar->Add(mod->ModuleName);
    }}
B. ArrayList^ ar = gcnew ArrayList();array<Process^> procs;ProcessModuleCollection^     
    modules;procs = Process::GetProcesses(@”C:\TestApps\Process1.exe”);if
    (procs->Length > 0) {
    modules = procs[0]->Modules;
    for each (ProcessModule^ mod in modules) {
    ar->Add(mod->ModuleName);
    }}
C. ArrayList^ ar = gcnew ArrayList();array<Process^> procs;ProcessModuleCollection^     
    modules;procs = Process::GetProcesses(@”Process1”);if (procs->Length > 0) {
    modules = procs[0]->Modules;
    for each (ProcessModule^ mod in modules) {
    ar->Add(mod->FileName);
    }}
D. ArrayList^ ar = gcnew ArrayList();array<Process^> procs;ProcessModuleCollection^ 
    modules;procs = Process->GetProcessesByName(@”C:\TestApps\Process1.exe”);if (procs-    
    >Length > 0) {
    modules = procs[0]->Modules;
    for each (ProcessModule^ mod in modules) {
    ar->Add(mod->FileName);
    }}


Answer: C
 

No comments:

Post a Comment