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 Dim ar As New ArrayList()
Dim procs As Process()
Dim modules As ProcessModuleCollection
procs = Process.GetProcesses("Process1")
If procs.Length > 0
Then modules = procs(0).Modules
For Each pm As ProcessModule In Modules
ar.Add(pm.ModuleName)
Next
End If 

B Dim ar As New ArrayList()
"A Composite Solution With Just One Click" - Certification Guaranteed 141 Microsoft 70-536 Exam
Dim procs As Process()
Dim modules As ProcessModuleCollection
procs = _
Process.GetProcessesByName("C:\TestApps\Process1.exe") If procs.Length > 0 Then
modules = procs(0).Modules
For Each pm As ProcessModule In Modules
ar.Add(pm.FileName)
Next
End If 

C Dim ar As New ArrayList()
Dim procs As Process()
Dim modules As ProcessModuleCollection
procs = Process.GetProcessesByName("Process1")
If procs.Length > 0 Then
modules = procs(0).Modules
For Each pm As ProcessModule In Modules
 ar.Add(pm.FileName)
Next
End If 

D Dim ar As New ArrayList()
Dim procs As Process()
Dim modules As ProcessModuleCollection
procs = Process.GetProcesses("C:\TestApps\Process1.exe") If procs.Length > 0 Then
modules = procs(0).Modules
For Each pm As ProcessModule In Modules
ar.Add(pm.ModuleName)
Next
End If 

+ Answer
+ Report
Total Preview: 834

Copyright © 2024. Powered by Intellect Software Ltd