PowerShell - Variables and Data TypesWhich of the following is the correct way to assign a Boolean value in PowerShell?A$flag = $trueB$flag = TrueC$flag := $trueDflag = $trueCheck Answer
Step-by-Step SolutionSolution:Step 1: Check assignment syntax in PowerShellPowerShell uses = to assign values to variables, and variables start with $.Step 2: Identify correct Boolean value and syntaxThe Boolean value must be $true with $ sign, and assignment uses =.Final Answer:$flag = $true -> Option AQuick Check:Assign Boolean with $true and = [OK]Quick Trick: Use $true with = for Boolean assignment [OK]Common Mistakes:Missing $ on Boolean valueUsing := instead of =Missing $ on variable name
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