CIS121AH Powershell Chapter 9
The step parameter must be used to increment the control variable. No other assignment is valid.
False
A for loop can be used with no parameters, with just 2 semicolons like the following: for(;;) { }
True
How many times would a loop execute with the following statement? for($x=10;$x -le 20;$x=$x+2) { }
6
The for loop will continue while the condition is false.
False
Which of the following programming errors will not cause an infinite loop?
Syntax error
A break statement terminates a loop and a continue statement moves to the next iteration of the loop.
True
A loop that does not have the ability to end is called an infinite loop.
True
The while loop continues to execute while the condition is true.
True
Which of the following is the proper syntax for a while loop?
Which of the following is the proper syntax for a while loop? while($x -lt 10) { $x++ }
Which of the following is the correct syntax of a for loop?
for ($x=0; $x -gt 10; $x++) { Write-Host $x }