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? - (VB.Net)
A Dim ar As New ArrayList()
Dim procs As Process()
Dim [module] As ProcessModuleCollection
procs = Process.GetProcesses("Process1")
If procs.Length > 0 Then
[module] = procs(0).Modules
For Each [mod] As ProcessModule In modules
ar.Add([mod].ModuleName)
Next
End If
B Dim ar As New ArrayList()
Dim procs As Process()
Dim [module] As ProcessModuleCollection
procs = Process.GetProcesses("C:\TestApps\Process1.exe")
If procs.Length > 0 Then
[module] = procs(0).Modules
For Each [mod] As ProcessModule In modules
ar.Add([mod].ModuleName)
Next
End If
C Dim ar As New ArrayList()
Dim procs As Process()
Dim [module] As ProcessModuleCollection
procs = Process.GetProcessesByName("Process1")
If procs.Length > 0 Then
[module] = procs(0).Modules
For Each [mod] As ProcessModule In modules
ar.Add([mod].FileName)
Next
End If
D Dim ar As New ArrayList()
Dim procs As Process()
Dim [module] As ProcessModuleCollection
procs = Process.GetProcessesByName("C:\TestApps\Process1.exe")
If procs.Length > 0 Then
[module] = procs(0).Modules
For Each [mod] As ProcessModule In modules
ar.Add([mod].FileName)
Next
End If