PowerShell - Variables and Data TypesWhich of the following is a valid Boolean expression in PowerShell?Atrue == falseB$true = $falseC$true -eq $falseDTrue = FalseCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand PowerShell Boolean comparison syntaxPowerShell uses '-eq' to compare values, not '=' or '==' which are invalid for comparison.Step 2: Evaluate each option$true -eq $false uses '$true -eq $false' which is valid and returns False. Options B, C, and D use invalid syntax for comparison.Final Answer:$true -eq $false -> Option CQuick Check:Boolean comparison uses '-eq' = A [OK]Quick Trick: Use '-eq' for equality checks in PowerShell [OK]Common Mistakes:Using '=' instead of '-eq' for comparisonUsing '==' which is not valid in PowerShellConfusing assignment with comparison
Master "Variables and Data Types" in PowerShell9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PowerShell Quizzes Cmdlets and Pipeline - Where-Object for filtering - Quiz 11easy Cmdlets and Pipeline - Get-Member for object inspection - Quiz 2easy Control Flow - For loop - Quiz 10hard Control Flow - For loop - Quiz 15hard Operators - Range operator (..) - Quiz 11easy Operators - Why operators perform comparisons and logic - Quiz 11easy PowerShell Basics and Environment - Command discovery (Get-Command) - Quiz 2easy PowerShell Basics and Environment - First PowerShell command - Quiz 2easy String Operations - Select-String for searching - Quiz 10hard Variables and Data Types - Why variables store data - Quiz 15hard