lecture 6 Flashcards

information encoding

1
Q

machine language

A

binary numbers only

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

binary encoding

A

convert data into different form or representation

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

base-10

A

decimal numbers
0-9

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

base-2

A

binary
0-1

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

base-16

A

hexidecimal
0-9, A-F

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

base-10 equation

A

v = Σ (10^i)(d)
*key:
v –> base-10 value
i –> digit position (increases right
to left starting @ 0)
d –> decimal digit

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

what is each base-10 digit multiplied by?

A

power of 10

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

base-10 example)
173
1 7 3

= 173
how is this equal to 173?

A

1 7 3
10^2 + 10^1 + 10^0
= 1(10^2) + 7(10^1) + 3(10^0)
= 173

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

base-2 equation

A

v = Σ 2^i bi
*key:
v –> base-2 number
i –> digit position (increasing
from right to left, starting @
0)
b –> binary digit (either 1 or 0)

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

what is each base-2 digit multiplied by?

A

power of 2

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

base-2 example)
011111010000

= 2000 (base-10)
how is this equal to 2000?

A

0 1 0 0 1 0 0 1
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0

= 1(2^6) + 1(2^3) + 1(2^0)
= 64 +8 +1
= 73

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

what is the most significant bit?

A

msb –> always going to be the greatest power of 2
(right most bit)

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

what is the least significant bit?

A

lsb –> always going to be the lowest power of 2
(left most bit)

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

0 1 0 0 1 0 0 1
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0

what is the msb?

A

2^7
- greatest power of 2 (right most bit)

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

0 1 0 0 1 0 0 1
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0

what is the lsb?

A

2^0
- least power of 2 (left most bit)
**always going to be 2^0

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

decimal to binary algorithm

A

v/2 = quotient, remainder = bit (going to be 0 or 1)
quotient/2, remainder = next bit (going to be 0 or 1)
STEPS:
divide v by 2
remainder becomes next bit
quotient becomes next v
**repeat until v = 0
- msb –> last bit found when v
= 0
- lsb –> first bit found
* first division –> remainder = lsb
* last division –> remainder = msb

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

base-16 equation

A

v = Σ 16^i d
*key:
v –> base-10 value
i –> digit position (increasing from
right to left, starting @ 0)
d –> hexit

18
Q

base-16 0-9 chart

A

0 - 0
1 - 1
2 - 2
3 - 3
4 - 4
5 - 5
6 - 6
7 - 7
8 - 8
9 - 9

19
Q

base-16 A-F chart

A

10 - A
11 - B
12 - C
13 - D
14 - E
15 - F

20
Q

what is each base-16 digit multiplied by?

A

power of 16

21
Q

how many bits is one hexit digit?

A

4 bits

22
Q

if you are converting binary to hexit, how do you go about doing this?

A

break up the binary digits every 4 digits starting at the lsb (leftmost bit)
- in each of these segments, the
digits’ indexes are from 2^0 to
2^3
- do the usual calculation and that’s
the hexit representation

23
Q

binary to hexit example)
011111010000

= 0x7D
how does this work?

A

011111010000
A) break up the binary into groups of 4
0111 1101 0000
B) calculate what number each 4 digits add up to
0000 = 0
1 1 0 1
2^3. 2^2. 2^1. 2^0
= 8 + 4 + 1
= 13 –> D
0 1 1 1
2^3. 2^2. 2^1. 2^0
= 4 + 2 + 1
= 7
C) put it together
011111010000 = 0x7D

24
Q

ASCII encoding allows what

A

conversion from character to number

25
Q

what is signed magnitude representation?

A

used to encode positive and negative binary numbers

26
Q

are the positive and negative binary representations different in signed magnitude?

A

no

27
Q

what is the difference between positive and negative binary reps in signed mag?

A

msb (most significant bit)
- msb = 0, positive number
- msb = 1, negative number

28
Q

range for values able to be represented in signed magnitude rep

A

-(2^N-1 - 1) to (2^N-1 - 1)

N = # of bits

29
Q

pros of signed magnitude

A

easy to negate
easy to compute abs value

30
Q

cons of signed magnitude

A

add/subtract is complex
2 different ways of repping 0
+0 and -0 –> two different things

31
Q

what is signed magnitude used for?

A

floating point representation
**not integers

32
Q

what is the two-step process for 2’s complement?

A
  1. complement every bit
    - 1 –> 0, 0 –> 1
  2. add 1 (binary addition)

** if neg –> pos rep
**if pos –> neg rep

33
Q

range for 2’s complement

A

(-2^N-1) to (2^N-1 -1)

N = # of bits

34
Q

is 2’s complement the same process for negating a negative binary number?

A

yes

35
Q

is adding the same thing as subtracting in 2s complement?

A

yes

36
Q

what is sign extension?

A

when you pad the binary number with 0s or 1s (to preserve the sign) if you need it to be an “extended”/bigger amount of bits

37
Q

pros of 2s complement

A

only add operation
only one zero rep
sign extension

38
Q

cons of 2s complement

A

more complex to negate and compute abs value

39
Q

floating point rep

A

(sign) (significand) x 2^(exponent)

  • sign –> positive and negative number determinant
  • normalized fraction (significand)
  • exponent (position of the “floating” binary point)
40
Q

what is IEEE 754 floating point rep?

A

used to represent double/float numbers (fractions)
sign field (s) –> 1 bit
- 0 : pos, 1 : neg
exponent field (E)
- 8 bits (exponent + 127)
fraction field –> 23 bits
- 23 bits significand w/o leading 1
*1 –> hidden (normalized)

41
Q

IEEE 754 floating point rep steps

A
  1. convert to binary
    - 4 bits on either side of decimal place
  2. normalize the fraction to 1.F
    - move it until its 1.F
  3. calculate the exponent
    - based on how many places you moved to normalized –> E - 127
    - convert to binary