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. Dim ar As New ArrayList()Dim procs As Process()Dim modules As 
    ProcessModuleCollectionprocs = Process.GetProcesses("Process1")If procs.Length > 0
    Thenmodules = procs(0).Modules
    For Each pm As ProcessModule In Modules
    ar.Add(pm.ModuleName)
    NextEnd If
B. Dim ar As New ArrayList()Dim procs As Process()Dim modules As
    ProcessModuleCollectionprocs = Process.GetProcesses("C:\TestApps\Process1.exe")If
    procs.Length > 0 Thenmodules = procs(0).Modules
    For Each pm As ProcessModule In Modules
    ar.Add(pm.ModuleName)
    Next End If
C. Dim ar As New ArrayList()Dim procs As Process()Dim modules As
    ProcessModuleCollectionprocs = Process.GetProcessesByName("Process1")If
    procs.Length > 0 Thenmodules = 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
    ProcessModuleCollectionprocs =
    _Process.GetProcessesByName("C:\TestApps\Process1.exe")If procs.Length > 0
    Thenmodules = procs(0).Modules
    For Each pm As ProcessModule In Modules
    ar.Add(pm.FileName)
    Next End If


Answer: C

No comments:

Post a Comment