YEAR 2 CO1 WEEK 6 BITWISE MANIPULATION Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is BitWise Manipulation used for?

A

Used for quickly doubling and halving
Encryption and decryption
Setting/resetting flags
Graphics Manipulation
Compression algorithms

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

How does Logical (Unsigned) Shift Left Work?

A

All digits are moved to the left.
Most significant bit (MSB) removed and a 0 added in place of Least Significant bit (LSB)

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

How does Logical(Unsigned) Right Shift?

A

Digits all moved to the right.
LSB removed and a 0 added in place of MSB.

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

How does Circular Shift Work?

A

With circular right shift, LSB copied into MSB. Everything else shifted to the right.
With circular left shift, MSB copied to LSB. Everything shifted to the left.

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

How does Arithmetic(Signed) Right Shift?

A

All digits moved to the right except the MSB that stays in the same place to preserve negativity or positivety of the number. MSB then copied to the right of it. LSB is removed.

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

How does Arithmetic(Signed) Left Shift?

A

All digits moved to left except MSB stays in same order to preserve negativety and positivety of number.

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

Describe Masking?

A

Allows you to check the value of a particular bit in binary number. Used because not possible to read and write those bits individually.

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

Describe AND Masking.

A

If wanted to find value of 5th bit of an 8th bit binary number
Mask uses 0s for each bit value except the position of bit you want to check in the binary number.
Logical AND operation then performed on the two numbers and would result in a 1 If both are 1s or else a 0.

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

Describe OR Masking.

A

If MASK bit is false, then value written to A is the same as it was.
If MASK bit true, then value of A is set (forced to be true)

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

Describe XOR Masking.

A

If the MASK bit is FALSE, then value written to A the same as what was already there.
If MASK bit is TRUE, then value written to A is the opposite of what was already there.

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