Multiple choice technology

Which of the below statement(s) is/are correct?

  1. Variables in the global scope are visible in all scopes

  2. Variables in the script scope are visible to all scopes within that script file.

  3. Variables in the local scope are visible only in the current scope and not to its children.

  4. Private scope variables are visible only to that current scope.

Reveal answer Fill a bubble to check yourself
A,B,D Correct answer
Explanation

Global scope variables are accessible from anywhere in PowerShell. Script scope variables are visible throughout the script file. The statement C is incorrect because local scope variables ARE inherited by child scopes - they remain visible in nested scopes. Private scope is the only scope that doesn't inherit to children.