Google News
logo
PowerShell - Quiz(MCQ)
How do you declare a type of variable when declaring a variable?
A)
With parentheses surrounding the type of variable before the declaration (ie. "(integer) $variable"
B)
With square brackets surrounding the type of variable before the declaration (ie. "[integer] $variable"
C)
By stating that the variable equals the type of variable before declaring the actual variable (ie. "$variable=integer")
D)
You cannot declare the type of variable, powershell does this automatically when you declare the variable for the first time.

Correct Answer :   With square brackets surrounding the type of variable before the declaration (ie. "[integer] $variable"

Advertisement