Multiple choice technology

If the below code will be executed what will be the output? $strA = "fast" Write-Host 'Tom drives a $strA car.'

  1. Tom drives a fast car

  2. Tom drives a $strA car.
  3. Tom drives a “fast” car.

  4. none of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

PowerShell single quotes treat everything literally - \$strA is not expanded but treated as the literal string '\$strA'. Double quotes would expand variables. The output is exactly 'Tom drives a $strA car.' with the variable name displayed, not its value 'fast'.