PowerShell - OperatorsYou want to calculate the average of three numbers: 10, 20, and 30 in PowerShell. Which code correctly does this?A$avg = (10 + 20 + 30) * 3B$avg = 10 + 20 + 30 / 3C$avg = 10 * 20 * 30 / 3D$avg = (10 + 20 + 30) / 3Check Answer
Step-by-Step SolutionSolution:Step 1: Sum the numbers inside parentheses10 + 20 + 30 = 60.Step 2: Divide the sum by 3 to get average60 / 3 = 20.Final Answer:$avg = (10 + 20 + 30) / 3 -> Option DQuick Check:Parentheses ensure correct sum before division [OK]Quick Trick: Use parentheses to sum before dividing for average [OK]Common Mistakes:Missing parentheses causing wrong orderMultiplying instead of dividingDividing only last number
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