Question is -
Type the comparison that will allow PowerShell to determine if the fourth bit is "turned on" in the value 192.
Answer is -
129 -band 8
8 -band 129
I am at a loss here... If this is indeed correct can someone please explain?
Windows PowerShell 101 DVD Question
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- jsclmedave
- Posts: 11
- Last visit: Tue Jul 22, 2008 5:52 am
Windows PowerShell 101 DVD Question
Question is -
Type the comparison that will allow PowerShell to determine if the fourth bit is "turned on" in the value 192.
Answer is -
129 -band 8
8 -band 129
I am at a loss here... If this is indeed correct can someone please explain?
Type the comparison that will allow PowerShell to determine if the fourth bit is "turned on" in the value 192.
Answer is -
129 -band 8
8 -band 129
I am at a loss here... If this is indeed correct can someone please explain?
Windows PowerShell 101 DVD Question
Bit 4 has a value of 8 when set.
2 ** (4-1) or 2 two the third power which is 2 * 2 * 2 or 8.
if bit and 8 matces bit by bit with 129 it will be true.
129 = 10000001 ( 128 + 1) or ( bit 8 + bit 1)
8 = 00001000
Does it match at the bit position.
Try 137 -band 8 it will tell you True.
false = 0
true <> 0
Try the following
[bool]0
[bool]1
[bool]-1
[bool](129 -band 8)
[bool](137 -band 8)
[bool](8 -band 8)
Now are you a believer?
2 ** (4-1) or 2 two the third power which is 2 * 2 * 2 or 8.
if bit and 8 matces bit by bit with 129 it will be true.
129 = 10000001 ( 128 + 1) or ( bit 8 + bit 1)
8 = 00001000
Does it match at the bit position.
Try 137 -band 8 it will tell you True.
false = 0
true <> 0
Try the following
[bool]0
[bool]1
[bool]-1
[bool](129 -band 8)
[bool](137 -band 8)
[bool](8 -band 8)
Now are you a believer?
- jsclmedave
- Posts: 11
- Last visit: Tue Jul 22, 2008 5:52 am
Windows PowerShell 101 DVD Question
Where does the 129 come in? They are all false which I get. The 4th BIT which is 8 in not true.
PS Z:> [bool]0FalsePS Z:> [bool]1TruePS Z:> [bool]-1TruePS Z:> [bool](129 -band 8)FalsePS Z:> [bool](137 -band 8)TruePS Z:> [bool](8 -band 8)TruePS Z:> [bool](8 -band 129)FalsePS Z:> [bool](8 -band 192)FalsePS Z:> [bool](192 -band 8)FalsePS Z:>
So shouldnt the answer to this question be - ?
192 -band 8
8 -band 192
It looks like a typo... If not I am completely lost as to where the 129 came from...
PS Z:> [bool]0FalsePS Z:> [bool]1TruePS Z:> [bool]-1TruePS Z:> [bool](129 -band 8)FalsePS Z:> [bool](137 -band 8)TruePS Z:> [bool](8 -band 8)TruePS Z:> [bool](8 -band 129)FalsePS Z:> [bool](8 -band 192)FalsePS Z:> [bool](192 -band 8)FalsePS Z:>
So shouldnt the answer to this question be - ?
192 -band 8
8 -band 192
It looks like a typo... If not I am completely lost as to where the 129 came from...
Windows PowerShell 101 DVD Question
Sorry, "192." Misread the question. But yes, the correct answer should be
8 -band 192
or
192 -band 8
If it isn't accepting that, then there may be a typo in the quiz module. It's also possible there's an extra or missing space; the quiz module is unfortunately extremely picky about that kind of thing.
8 -band 192
or
192 -band 8
If it isn't accepting that, then there may be a typo in the quiz module. It's also possible there's an extra or missing space; the quiz module is unfortunately extremely picky about that kind of thing.
- jsclmedave
- Posts: 11
- Last visit: Tue Jul 22, 2008 5:52 am
Windows PowerShell 101 DVD Question
Thank you all for the clarification and detailed information! Don - The module states the correct answer is - 129 -band 88 -band 129
So yes, I believe it
So yes, I believe it