Complete the code to declare an integer variable with value 10.
$number = [1]The value 10 without quotes is an integer in PowerShell.
Complete the code to declare a floating-point variable with value 3.14.
$pi = [1]The value 3.14 without quotes is a floating-point number in PowerShell.
Fix the error in the code to correctly convert a string to an integer.
$num = [int][1]To convert a string to an integer, the string must be in quotes inside the cast.
Fill both blanks to declare a floating-point variable and display its type.
$value = [1] $type = $value.GetType().[2]
5.5 is a floating-point number. The property 'Name' shows the type name.
Fill all three blanks to create a hashtable with integer keys and floating-point values (some greater than 2.5).
$data = @{1 = [1]; 2 = [2]; 3 = [3]
$result = @{}
foreach ($key in $data.Keys) {
if ($data[$key] -gt 2.5) {
$result[$key] = $data[$key]
}
}
$resultThe hashtable has values 1.5, 3.0, and 4.5. The script filters values greater than 2.5, so 3.0 and 4.5 are included.