Bird
0
0

What does a while loop do in PowerShell?

easy📝 Conceptual Q1 of 15
PowerShell - Control Flow
What does a while loop do in PowerShell?
AExecutes code a fixed number of times
BExecutes code once before checking a condition
CRuns code only if a condition is false
DRepeats a block of code while a condition is true
Step-by-Step Solution
Solution:
  1. Step 1: Understand the while loop behavior

    A while loop checks a condition before running the code inside it.
  2. Step 2: Identify the loop's repetition condition

    The loop repeats as long as the condition remains true, stopping when it becomes false.
  3. Final Answer:

    Repeats a block of code while a condition is true -> Option D
  4. Quick Check:

    While loop = Repeats while condition true [OK]
Quick Trick: While loops check condition before running code [OK]
Common Mistakes:
  • Confusing while with do-while loops
  • Thinking it runs code at least once always

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes