Section 6: Data types Flashcards

1
Q

What is a fixed point binary number?

A

A fixed point binary number is a binary number with a binary point that allows you to represent decimals with binary.

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

How does the placement of a binary point affect the range and precision of the number?

A

The further to the right the binary point is, the higher the range and the lower the precision.

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

What is a floating point binary number?

A

A floating point binary number is a representation of a binary number involving a mantissa and an exponent that allows you to represent very high numbers.

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

How do you convert a floating point binary number to denary?

A
  1. Translate the exponent from binary to denary e.g. 0011 = 3
  2. Move the decimal point to the right by the same number as the exponent (if exponent is negative, move to the left)
  3. Translate the new binary number to denary
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you convert a floating point number with a negative mantissa to denary?

A

You find the two’s compliment of the mantissa then complete the rest of the steps as normal (remembering there is a minus sign at the beginning).

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

What is normalisation?

A

Normalisation is the process of moving the binary point of a floating number to provide the maximum level of precision for a given number of bits.

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

How is a positive normalised floating point binary number represented?

A

A positive normalised floating point binary number has a sign bit of 0 and the next digit is always 1.

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

How do you normalise a positive floating point binary number?

A
  1. Move the binary point to the right until there is a 1 after the sign bit e.g. by 3 places
  2. Since the mantissa has become larger, the exponent needs to be made smaller so you would subtract the number of places the binary point has moved from the exponent (e.g. subtract 3)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is a negative normalised floating point binary number represented?

A

A negative normalised floating point binary number has a sign bit of 1 and the next bit is always 0.

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

How do you normalise a negative floating point binary number?

A
  1. Move the binary point to the right until there is a 0 after the sign bit
  2. Take the amount of places that you shifted the binary point by from the exponent (e.g. shift 3 places, take 3 from the exponent)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you convert from denary to a normalised floating point binary number?

A
  1. Convert the denary number to a fixed point binary number
  2. Move the binary point so that it is in a normalised format
  3. Change the exponent to match how you have changed the binary point (e.g. if you move it 3 to the left, exponent becomes 3 from 0)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you add/subtract floating point numbers?

A
  1. Line up the points by making the exponents equal
  2. Add or subtract the mantissas
  3. Normalise the result
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In a logical right shift, which bit is replaced (and what with?)

A

In a logical right shift, the most significant bit is replaced by a 0 and the least significant bit moves into the carry bit.

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

In a logical left shift, which bit is replaced (and what with?)

A

In a logical left shift, the least significant bit is replaced by a 0 and the most significant bit moves into the carry bit.

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

What is the key difference between a logical shift and an arithmetic shift?

A

The key difference between a logical shift and an arithmetic shift is that an arithmetic shift keeps the sign bit constant.

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

What is a primitive data type?

A

A primitive data type is one that is provided by the programming language.

17
Q

What is underflow?

A

Underflow occurs when a number is too small to be represented in the allocated number of bits, e.g. on a calculator when a number is extremely small it is often represented by a 0.

18
Q

What is overflow?

A

Overflow occurs when a number is too large to be represented in the allocated number of bits.

19
Q

How does a circular shift work?

A

In a circular shift right, the value in the least significant bit is moved into the carry bit, and the carry bit is moved into the most significant bit.