1/9
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Conditions must be bounded by _____
()
What is wrong with the following statement?
if ($abc == "One")
{Write-Host "They are equal"}
The == cannot be used as a conditional operator. You must use -eq
Play computer. What is the first line printed by the code below?
$val = "Red"
$b=0
$r=0
$g=0
switch ($val)
{
"Blue" {
$b++
Write-host "Violets are Blue"}
"Green" {
$g++
Write-host "Leaves are green"}
"Red" {
$r++
Write-host "Apples are red"}
}
Write-host "B = $b g = $g R = $r"
Apples are red
What output would result from the following command?
$n = 3
if ($n -lt 5)
{ write-host $n}
3
What does the following code do?
if (test-connection -Computername "SRV1" -quiet -count 1 )
{
get-content -path \\SRV1\c$\config.txt
}
If SRV1 is "pingable", it retrieves the contents of the specified file
Play Computer. What will be printed by the code below?
for ($var = 0; $var -lt 3; $var++)
{ write-host $var }
0 1 2
Play Computer. Step through the following program statements, keeping track of what is stored in memory and what is output. Select the answer that correctly shows what is output following execution.
$grd = 75
$numpass = 0
$numfail = 0
if ($grd -lt 60)
{ numfail++ }
else
{numpass++}
write-host "Number passing = $numpass, Number failing = $numfail"
Number passing = 1, Number failing = 0
Play Computer. What will be printed by the code below?
$counter = 0
while ($counter -lt 5)
{
$counter
$counter++
}
0 1 2 3 4
A condition must evaluate to be _______.
boolean ($true or $false)
Play Computer. What will be printed by the statements below, assuming Cottonmouth and Diamond can be contacted, but Python can't.
$s = @("Cottonmouth", "Diamondback", "Python")
foreach ($i in $s)
{
if (test-connection -Computername $i -quiet -count 1)
{ write-host "$i is up"
}
else
{ write-host "$i is down"}
}
Cottonmouth is up Diamondback is up Python is down