Recall & Review
beginner
What is an integer type in PowerShell?
An integer type is a number without decimals. It can be positive or negative, like 5 or -10.
Click to reveal answer
beginner
What is a floating-point type in PowerShell?
A floating-point type is a number that can have decimals, like 3.14 or -0.5.
Click to reveal answer
beginner
How do you declare an integer variable in PowerShell?
You can declare an integer by assigning a whole number to a variable, for example: $num = 10
Click to reveal answer
beginner
How do you declare a floating-point variable in PowerShell?
You declare it by assigning a decimal number to a variable, for example: $num = 3.14
Click to reveal answer
intermediate
What happens if you add an integer and a floating-point number in PowerShell?
PowerShell converts the integer to floating-point and adds them, keeping the decimal part.
Click to reveal answer
Which of these is an integer in PowerShell?
✗ Incorrect
42 is a whole number without decimals, so it is an integer.
What type is the number 7.0 in PowerShell?
✗ Incorrect
7.0 has a decimal point, so it is a floating-point number.
How does PowerShell treat the expression 5 + 2.5?
✗ Incorrect
PowerShell converts 5 to floating-point and adds 2.5, resulting in 7.5.
Which variable assignment creates a floating-point number?
✗ Incorrect
10.0 has a decimal, so $x becomes a floating-point number.
What is the output type of this code? `$a = 3; $b = 4.5; $c = $a + $b`
✗ Incorrect
Adding integer 3 and floating-point 4.5 results in floating-point 7.5.
Explain the difference between integer and floating-point types in PowerShell.
Think about numbers you use in daily life like 5 vs 3.14.
You got /3 concepts.
Describe what happens when you add an integer and a floating-point number in PowerShell.
Consider how 5 + 2.5 becomes 7.5.
You got /3 concepts.