PowerShell Comparison and Logical Operators
Quiz by Aaron Curtis
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Measure skills
from any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
With a free account, teachers can
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
11 questions
Show answers
- Q1Write an expression testing whether the variable $name is equal to 'Sale'$name -eq 'Sale'$name -is 'Sale'$name = 'Sale'$name == 'Sale'30s
- Q2Write an expression testing whether 9 is less than 89 < 8less(9,8)9 -lt 88 < 930s
- Q3Write an expression testing whether 7 is greater than 6isGreater(7,6)7 -gt 69 -more 67 > 630s
- Q4Write an expression testing whether 10 is less than or equal to 2010 -le 2010 -lessThanEqual 20lessEqual(10,20)10 <= 2030s
- Q5Write an expression testing whether the variable $abc contains the string 'love'$abc -like '*love*''*love*' -like $abc'love' -like $abc$abc -like 'love'30s
- Q6Write an expression testing whether the variable $def contains the string 'hash'. The test should be case sensitive.$def -like '%hash%'$def -clike '*hash*'$def -case '*hash*'$def -like '*hash*'30s
- Q7The variable $abc contains the string 'I love hash tables'. Write an expression to display the contents of $abc but replacing 'tables' with 'browns'$abc -rep 'tables', 'browns'$abc >> $abc - 'tables' + 'browns'$abc -replace 'tables', 'browns'$abc | 'tables', 'browns'30s
- Q8Write an expression testing whether $num is NOT equal to 8.$num -ne 8$num <> 8$num != 8!($num = 8)30s
- Q9Write an expression testing whether $a is equal to 3 AND $b is less than or equal to 5($a -eq 3) -and ($b -le 5)($a -eq 3) AND ($b -le 5)($a -eq 3) & ($b -le 5)($a -eq 3) && ($b -le 5)30s
- Q10Write an expression testing whether $a contains the string 'windows' OR $b is less than 9($a -like '*windows*') ^ ($b -lt 9)($a -like '*windows*') OR ($b -lt 9)($a -like '*windows*') -or ($b -lt 9)($a -like '*windows*') || ($b -lt 9)30s
- Q11Write and expression testing whether $a equal 2 or $b equals 8. Only one of these two statements may be true.($a -eq 2) -xor ($b -eq 8)($a -eq 2) <-> ($b -eq 8)($a -eq 2) XOR ($b -eq 8)($a -eq 2) <>OR ($b -eq 8)30s