PowerShell - OperatorsWhich of these PowerShell expressions uses the range operator correctly to create numbers from 10 down to 6?A10..6 | Sort-ObjectB10..6C10 - 6D6..10Check Answer
Step-by-Step SolutionSolution:Step 1: Identify how the range operator works with descending numbersWhen the left number is greater than the right, the range operator creates a descending sequence.Step 2: Check the options10..6 uses 10..6 which creates 10, 9, 8, 7, 6. 6..10 creates ascending 6 to 10. 10 - 6 is subtraction, not range. 10..6 | Sort-Object sorts ascending, not descending.Final Answer:10..6 creates a descending sequence from 10 to 6 -> Option BQuick Check:Descending range = left..right with left>right [OK]Quick Trick: Range operator can create descending sequences if left>right [OK]Common Mistakes:Assuming range operator only creates ascending sequencesUsing subtraction instead of range operatorSorting ascending instead of descending
Master "Operators" in PowerShell9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PowerShell Quizzes Control Flow - Why control flow directs execution - Quiz 2easy Control Flow - Why control flow directs execution - Quiz 13medium Operators - Assignment operators - Quiz 2easy Operators - Ternary operator (PowerShell 7+) - Quiz 12easy Operators - Ternary operator (PowerShell 7+) - Quiz 11easy Operators - Why operators perform comparisons and logic - Quiz 15hard Operators - Ternary operator (PowerShell 7+) - Quiz 6medium String Operations - Why string manipulation is frequent - Quiz 3easy Variables and Data Types - Automatic variables ($_, $PSVersionTable) - Quiz 4medium Variables and Data Types - Automatic variables ($_, $PSVersionTable) - Quiz 11easy