PowerShell - OperatorsWhy does the expression '$a / $b' in PowerShell sometimes return a decimal and sometimes an integer?ABecause PowerShell automatically converts to floating point if neededBBecause division operator returns only integersCBecause variables must be declared as integers explicitlyDBecause PowerShell does not support divisionCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand PowerShell division behaviorPowerShell returns a floating-point number if division is not exact.Step 2: Recognize automatic type conversionPowerShell converts to decimal automatically when needed.Final Answer:Because PowerShell automatically converts to floating point if needed -> Option AQuick Check:Division returns float or int based on values [OK]Quick Trick: Division returns float if remainder exists, else integer [OK]Common Mistakes:Thinking division returns only integersBelieving explicit int declaration neededAssuming division unsupported
Master "Operators" in PowerShell9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PowerShell Quizzes Cmdlets and Pipeline - Verb-Noun naming convention - Quiz 14medium Cmdlets and Pipeline - Pipeline concept (|) - Quiz 7medium Cmdlets and Pipeline - Get-Help for documentation - Quiz 3easy Control Flow - Switch with wildcard and regex - Quiz 4medium Control Flow - While and Do-While loops - Quiz 7medium Operators - Comparison operators (-eq, -ne, -gt, -lt) - Quiz 6medium Operators - Why operators perform comparisons and logic - Quiz 14medium String Operations - Why string manipulation is frequent - Quiz 6medium Variables and Data Types - Variable creation with $ - Quiz 5medium Variables and Data Types - Arrays - Quiz 10hard