1.4.1 Data types Flashcards Preview

A Level Computer Science > 1.4.1 Data types > Flashcards

Flashcards in 1.4.1 Data types Deck (12)
Loading flashcards...
1

What are the three types of bitwise shifts?

Logical shift

Arithmetic shift

Circular shift

2

Explain a logical shift

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

It doesn't account for the sign bit

3

How is a logical shift padded?

MSB/LSB is padded with a 0

4

Explain an arithmetic shift

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

It accounts for the sign bit

5

What is the effect of an arithmetic shift?

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

6

How is an arithmetic shift padded?

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

7

Explain a circular shift

The LSB becomes the MSB, or vice versa

8

What is the effect of a circular shift?

No bits are lost

9

What are the three types of binary masks?

AND

OR

XOR

10

What is the purpose of an AND mask?

Extracts a subset of bits in the value

11

What is the purpose of an OR mask?

Sets a subset of bits to the value

12

What is the purpose of an XOR mask?

Toggles a subset of the bits