Bird
0
0

What does the '-and' operator do in a PowerShell conditional statement?

easy📝 Conceptual Q2 of 15
PowerShell - Operators
What does the '-and' operator do in a PowerShell conditional statement?
AChecks if conditions are equal
BChecks if either condition is true
CNegates the condition
DChecks if both conditions are true
Step-by-Step Solution
Solution:
  1. Step 1: Understand logical operators in PowerShell

    '-and' is a logical operator that requires both conditions to be true.
  2. Step 2: Compare '-and' with other logical operators

    '-or' checks if either condition is true, '-not' negates a condition.
  3. Final Answer:

    Checks if both conditions are true -> Option D
  4. Quick Check:

    '-and' means both true = true [OK]
Quick Trick: Use '-and' to require all conditions true [OK]
Common Mistakes:
  • Mixing '-and' with '-or'
  • Thinking '-and' negates
  • Confusing with equality operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes