1.4.1 Data types Flashcards

1
Q

What are the three types of bitwise shifts?

A

Logical shift

Arithmetic shift

Circular shift

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

Explain a logical shift

A

All binary bits move the number of stated places to the left or right

It doesn’t account for the sign bit

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

How is a logical shift padded?

A

MSB/LSB is padded with a 0

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

Explain an arithmetic shift

A

All binary bits move the stated number of places to the left or right

It accounts for the sign bit

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

What is the effect of an arithmetic shift?

A

Each shifted place is a factor of 2, left multiplies, right divides

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

How is an arithmetic shift padded?

A

The MSB is padded with a 0 for a positive or a 1 for a negative

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

Explain a circular shift

A

The LSB becomes the MSB, or vice versa

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

What is the effect of a circular shift?

A

No bits are lost

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

What are the three types of binary masks?

A

AND

OR

XOR

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

What is the purpose of an AND mask?

A

Extracts a subset of bits in the value

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

What is the purpose of an OR mask?

A

Sets a subset of bits to the value

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

What is the purpose of an XOR mask?

A

Toggles a subset of the bits

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