Bit-wise Operations(1.4.1 i) Flashcards

1
Q

What is a bit-wise operation?

A

any operation that is carried out one bit at a time
adding and subtracting and must be carried out from right to left
can do logical operations like AND OR XOR and NOT and can work in either direction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Bit-wise operation NOT

A

simplest bit-wise operation
simply flip every bit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a mask?

A

used in bit-wise operations to either reveal important information and/or hide unimportant information

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How is a mask applied?

A

AND and OR operations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

AND masks

A

0 hides unneeded bits as 0’s
1 reveals bits state
can be considered as extracting relevant bits for the task
unneeded bits are considered masked off
can’t go back once masked

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

OR masks

A

0 reveals relevant bit state
1 hides unneeded bits as 1’s
can be considered as extracting relevant bits
unneeded bits are masked on
used in LAN IP address allocation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

XOR masks

A

flip selected bits and leave unneeded bits
if the same mask is applied using XOR twice the bit string returns to its original state
can be used for encryption
reversible given same mask

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Bit shifting

A

each shift left is equivalent to multiplying by 2(10) or 10(2)
each shift right is equivalent to dividing by 2(10) or 10(2)
any bits to flow out of scope are dropped

How well did you know this?
1
Not at all
2
3
4
5
Perfectly