Unit 6 - Data Types Flashcards

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

binary addition rules

A
  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 1 = 0 carry 1
  • 1 + 1 + 1 = 1 carry 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is an overflow

A

when the arithmetic result exceeds the available number of bits

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

what does one shift to the left do

A

x 2

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

what does one shift to the right do

A

/2

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

how does twos complement work

A

-128, 64, 32, 16, 8, 4, 2, 1

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

how to work out if the denary value will be positive or negative in twos complement

A

starts with 0 = positive
starts with 1 = negative

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

how convert a negative denary number to binary

A
  • flip all of the bits
  • add 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

how to convert a negative twos complement binary number to denary

A
  • flip the bits
  • add one
  • negative sign in-front of byte
  • convert
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how to do binary subtraction using twos complement

A
  • convert negative binary number into twos complement
  • add positive binary value and twos complement value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

why are fixed point binary number useful

A
  • represent fractions in binary
  • increased performance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is limited by fixed point binary

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

advantages of floating point binary

A
  • greater range
  • greater accuracy
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what does moving the point to the right in floating point binary do

A

increase range
reduces precision

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

what does moving the point to the left in floating point binary do

A

reduces range
increases precision

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

what is the mantissa

A

the coefficient

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

what is the exponent

A

the order of magnitude

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

positive exponent means

A

decimal point moves right

18
Q

negative exponent means

A

decimal point moves left

19
Q

how to handle negative exponents

A
  • twos complement of exponent
  • move the binary point of the mantissa by exponent to the left
  • translate to denary
20
Q

how to handle negative mantissas

A
  • find twos complement of mantissa
  • translate exponent to denary
  • move binary point by exponent to the right
  • translate this to binary
21
Q

what does the sign bit show

A

positive or negative value of mantissa
- 0. = positive
- 1. = negative

22
Q

what is normalisation

A

process of moving the binary point of a floating point number to provide the maximum level of precision for a given number of bits. this is achieved by ensuring that the first digit after the binary pin t is a significant digit

23
Q

how to normalise a positive binary number

A

a positive number has a sign but if 0 and the next digit is always 1. this means the mantissa of a positive number in normalised for always lies between 1/2 and 1

24
Q

normalising a negative binary number

A

a normalised negative number has a sign but of 1 and the next bit is always 0

25
Q

increase size of mantissa

A

greater precision

26
Q

increase size of exponent

A

increase range

27
Q

how convert from denary to normalised binary floating point

A
  • convert to fixed point binary
  • then use an exponent to make the mantissa normalised
28
Q

how to do floating point addition and subtraction

A
  • line up the points by making the exponents equal
  • add or subtract the mantissas
  • normalise the result
29
Q

what is an under flow error

A

when a result is to small to be represented by the allotted number of bits

30
Q

what is a logical shift

A

all the bits move right or left. a logical shift causes the least significant bit to be shifted into the carry bit and a zero moves into the most significant bit to occupy the vacated space

31
Q

what is an arithmetic shift

A

similar to a logical shift but takes into account the sign bit, which always remains the same. therefore the first or last bit of the mantissa moves into the carry bit and the sign bit remains the same

32
Q

how to multiply two binary numbers

A
  • use addition and shifts
33
Q

what is a circular shift

A

a rotate or circular shift is useful for performing shifts in multiple bytes. 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 her most significant bit

34
Q

what does an AND mask do

A

extracts
- to clear a particular bit, use a mask of 0 and the AND operator
- use a mask of 1 to leave a bit unchanged

35
Q

what does an OR mask do

A

sets
- to set a particular bit, use a mask of 1 and the OR operator.
- use a mask of 0 to leave a bit unchanged

36
Q

what does an XOR mask do

A

toggles
- to toggle a particular bit, use a mask of 1 and the XOR operator
- use a mask of 0 to leave a bit unchanged

37
Q

order of binary prefixes

A
  • kibi- KiB - 2^10
  • mebi - MiB - 2^20
  • gibi- GiB - 2^30
  • tebi- TiB - 2^40
38
Q

what is a primitive data type

A

one which is provided by a programming language

39
Q

what is a composite data type

A

not considered a primitive data type for example an array

40
Q

name the number bases and their base

A

denary - base 10
binary - base 2
hexadecimal - base 16

41
Q

name the character sets

A
  • 7-bit ASCII
  • 8-bit ASCII
  • Unicode
42
Q

how do character sets represent text

A

each character, number and symbol has a uniquely defined code