Binary shifting Flashcards

1
Q

What is binary shifting (bitwise shifting)

A

A binary shift means moving each bit in the direction defined by the amount defined. Since we work in bytes any bits that go outside our block of 8 are lost forever

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

Shifting left

A

Take a 1 byte binary value
e.g 00101000
and shift it left by 2 bits
10100000

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

Shifting right

A

Take a 1 byte binary value
e.g 00101000
and shift it right by 3 bits
00000101

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

what happens when we shift bits right

A

It halves its value

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

what happens when we shift bits left

A

it doubles its value

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

Shift the following Binary value 2 places to the right:
00111100

A

00001111

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

Shift the following Binary value 1 place to the left:

11011001

A

10110010

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

Divide the following Binary by 2:

00011101

A

00001110

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

Multiply the following Binary value by 8:

00011101

A

11101000

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