nerdexam
CompTIA

PT0-002 · Question #261

The following PowerShell snippet was extracted from a log of an attacker machine: A penetration tester would like to identify the presence of an array. Which of the following line numbers would…

The correct answer is A. Line 8. In PowerShell, arrays are defined using the @() syntax (e.g., $array = @('item1','item2')) or by assigning a comma-separated list of values to a variable (e.g., $array = 1,2,3). Line 8 contains this array declaration syntax. The other lines (13, 19, 20) would contain other…

Tools and Code Analysis

Question

The following PowerShell snippet was extracted from a log of an attacker machine:

A penetration tester would like to identify the presence of an array. Which of the following line numbers would define the array?

Exhibit

PT0-002 question #261 exhibit

Options

  • ALine 8
  • BLine 13
  • CLine 19
  • DLine 20

How the community answered

(30 responses)
  • A
    93% (28)
  • C
    3% (1)
  • D
    3% (1)

Explanation

In PowerShell, arrays are defined using the @() syntax (e.g., $array = @('item1','item2')) or by assigning a comma-separated list of values to a variable (e.g., $array = 1,2,3). Line 8 contains this array declaration syntax. The other lines (13, 19, 20) would contain other constructs such as loops, conditionals, or variable assignments that operate on the array rather than defining it.

Topics

#PowerShell#Array Definition#Script Analysis#Code Analysis

Community Discussion

No community discussion yet for this question.

Full PT0-002 Practice