Bird
0
0

Why must variables in PowerShell always start with the $ symbol?

hard📝 Conceptual Q10 of 15
PowerShell - Variables and Data Types
Why must variables in PowerShell always start with the $ symbol?
ATo distinguish variables from commands and keywords
BTo indicate the variable is a string
CTo mark the variable as global
DTo start a comment line
Step-by-Step Solution
Solution:
  1. Step 1: Understand PowerShell syntax design

    The $ symbol is used to clearly mark variables so the interpreter knows when a word is a variable versus a command or keyword.
  2. Step 2: Eliminate other options

    The symbol does not indicate string type, scope, or comments.
  3. Final Answer:

    To distinguish variables from commands and keywords -> Option A
  4. Quick Check:

    $ marks variables uniquely [OK]
Quick Trick: Use $ to mark variables, not for comments or types [OK]
Common Mistakes:
  • Thinking $ means string type
  • Confusing $ with comment symbol
  • Assuming $ marks global scope

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes