Multiple choice technology

If $a = “This is a string” then which of the below CmdLet will give the output as “a str”?

  1. $a.Substring(($a.length/4), ($a.length/2))
  2. $a.Substring(($a.length/2), ($a.length/3))
  3. $a.Substring(($a.length/3), ($a.length/2))
  4. $a.Substring(($a.length/2), ($a.length/4))
Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

$a = 'This is a string' (length 16). Option B: Substring(8, 5) extracts 5 characters starting from index 8. Index 8 is 'a' (0-based: T=0, h=1, i=2, s=3, space=4, i=5, s=6, space=7, a=8). Extracting 'a str' gives length 5, which matches.