Bird
0
0

You wrote this script in VS Code with PowerShell extension:

medium📝 Debug Q14 of 15
PowerShell - Basics and Environment
You wrote this script in VS Code with PowerShell extension:
Write-Host "Start"
Write-Host "End"

But when you run it, only "Start" appears and then it stops. What is the likely cause?
AThe script has a syntax error stopping execution.
BWrite-Host only prints the first line.
CThe integrated terminal is not open.
DYou pressed Ctrl+C stopping the script after first line.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze script behavior

    The script has two Write-Host lines, both valid and should print Start then End.
  2. Step 2: Consider why only first line prints

    If execution stops early, a manual interrupt like Ctrl+C is likely cause, not syntax or terminal issues.
  3. Final Answer:

    You pressed Ctrl+C stopping the script after first line. -> Option D
  4. Quick Check:

    Manual interrupt stops script early [OK]
Quick Trick: Check if script was manually stopped (Ctrl+C) [OK]
Common Mistakes:
  • Assuming syntax error without checking
  • Thinking terminal closed stops partial output
  • Believing Write-Host prints only first line

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes