Bird
0
0

What is the output of this PowerShell code?

medium📝 Command Output Q4 of 15
PowerShell - Variables and Data Types
What is the output of this PowerShell code?
$value = [double]'12.34'
Write-Output $value.GetType().Name
ADouble
BString
CInt32
DDecimal
Step-by-Step Solution
Solution:
  1. Step 1: Understand the cast to [double]

    The string '12.34' is cast to a double precision floating-point number.
  2. Step 2: Check the type name output

    $value.GetType().Name returns the type name of the variable, which is 'Double' after casting.
  3. Final Answer:

    Double -> Option A
  4. Quick Check:

    Cast string to double = Double type [OK]
Quick Trick: Casting string '12.34' to [double] yields Double type [OK]
Common Mistakes:
  • Expecting Int32 from decimal string
  • Confusing Decimal and Double types
  • Assuming string type remains

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes