Data Representation Flashcards

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

What is a bit?

A

A binary digit (0 or 1) (no voltage/voltage) (off/on)

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

What is a byte

A

8 bits

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

What is word size

A

The number of bits the processor can deal with in a single operation

E.g. if you have a 64 bit PC, it has a word size of 64 bits

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

How do you convert binary to decimal

A

Write column headings over each binary digit

128 64 32 16 8 4 2 1
1 0 1 0 1 0 1 1

128 + 32 + 8 + 2 + 1 = 171

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

How do you convert decimal to binary

A

Start with your decimal number (e.g. 83)

Write the column headings up to the first number bigger than 83

128 64 32 16 8 4 2 1
0 1 0 1 1 0 1 1

83 - 64 = 29
Put a 1 under the first number smaller or the same size as 29

29 - 16 = 13
Same again

16 - 13 = 3
Same again

3 - 2 = 1
Same again

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

How do you do binary addition

A

Like column addition

Each bit is added together

If the result is 2 or 3 then the first bit is carried over to the next column

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

Why do we use hexadecimal?

A

Because it keeps the numbers much shorter and easier to read

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

What are the 16 symbols used in hexadecimal

A

0 - 9 and A - F

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

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

How do you convert binary to hexadecimal

A

Split into groups of 4 bits and write the column headings 8, 4, 2, 1 over each set
8 4 2 1 8 4 2 1
E.g. 11101011 is therefore 1 1 1 0 | 1 0 1 1

1st set of 4 = 8+4+2 = 14, in hexadecimal that is E

2nd set of 4 = 8+4+2 = 14 in hexadecimal that is E

Therefore EE is the answer

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

Convert hexadecimal to binary

A

E.g. 30F

8 4 2 1 |8 4 2 1|8 4 2 1
0 0 1 1 |0 0 0 0|1 1 1 1

Proof:
First set of 4 = 2+1 = 3, in hexadecimal that is 3
Second set of 4 = 0, in hexadecimal that is 0
Third set of 4 = 8+4+2+1 = 15, in hexadecimal is F

Answer is 30F

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

How many characters are in the ASCII character set

A

127 characters

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

What does the ascii character set do

A

The ascii character set allocates each character with a number between 0 and 127

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

What is the recommend method for representing characters in modern day?

A

Unicode

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

How are integers usually represented

A

They are usually represented in Twos complement

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

How are real numbers represented (numbers that include fractions/values after the decimal point)

A

Normalised floating point

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

What is a method for recording signed integers

A

Sign and magnitude

The left-most bit is used as the sign bit

0 = +
1 = -
17
Q

What is the range of numbers that can be stored in 8 bits (sign and magnitude)

A

-127 to +127

18
Q

What is the range of numbers that can be stored in 8 bits unsigned

A

0 to +255

19
Q

How do you make a binary number twos complement

A

To make 44 into -44 we must do a process called taking the twos complement

I.e. start at the right hand side, copy each bit up to and including the first 1 and then reverse the rest

20
Q

What is the range of numbers that can be held in 8 bits twos complement

A

-128 to +127

21
Q

How do you do binary arithmetic subtraction

A

25 - 10 will be 25 + (-10)

25: 00011001
10: 00001010

Taking the 2s complement to make +10 into - 10

-10: 11110110

Then do column method

= 15

22
Q

What is a logical shift

A

Logical shift left

Before: 1 0 0 1 1 0 1 1

After: 0 0 1 1 0 1 1 0

All bits move left, bit falls off the end and a 0 appears on the right

Logical shift right

Before: 1 0 0 1 1 0 1 1

After: 0 1 0 0 1 1 0 1

All bits move right, bit falls off the end and a 0 appears on the left

23
Q

What is a arithmetic shift

A
  • arithmetic shift left is identical to logical shift left I.e. 0 always appears. 1 shift multiples the number by 2 (shift twice to multiply by 4, three times to multiply by 8 etc)
  • arithmetic shift right looks at the sign bit. If it is a 1 a 1 appears as the new digit. If it is a 0 a 0 appears as the new digit. Shift right divides the number by 2 (shift twice to divide by 4, three times to divide by 8 etc.)
24
Q

How do you do binary multiplication

A

-works similar to long multiplication

0  0  0  1  1  0  1  0
                 0  1  0  1   x
-----------------------------------
    1  0  1
        1  0  1
             1  0  1
-----------------------------------
1  0  0  0  0  0  1  0        = 130
  • left shift second number until right most bit is under each 1 in the first
  • add up each value
25
Q

How do you work out fractions in binary

A

E.g. 0 1 1 0 1 . 1 1 0

16 8 4 2 1 . ½ ¼ ⅛
0 1 1 0 1 . 1 1 0

8+4+1+½+¼ = 13¾(13.75)

26
Q

How to convert decimal fraction to binary fraction

A

E.g. 0.6875

1) multiply by 2:
0. 6875 x 2 = 1.375 the digit before the decimal is a 1 so the first binary digit to right of point is a 1

So far: 0.6875 = 0.1??????

2) discard the whole number part of the previous result (1.375) so it becomes (0.375) now multiply by 2 again
3) 0.375 x 2 = 0.75 the digit before the decimal point is a 0 so the 2nd digit is a 0

So far: 0.6875 = 0.10???????

4) 0.75 x 2 = 1.5 the digit before the decimal is a 1 so the third binary digit to right of point is a 1

So far 0.6875 = 0.101???? Discard 1 and continue

5) 0.5 x 2 = 1.0 the digit before decimal is 1, so that is the next digit

Discarding 1 means we are left with 0 so we are finished

Answer is 0.1010

27
Q

How do we write decimal numbers in standard form

A

Mantissa x 10^exponent

E.g.

0.000101 can be written as 0.101 x 2^-3

(Which would be 0.101 x 2^101 using 2s complement)

28
Q

What are standard form numbers called when written in binary

A

Normalised floating point

Can be written in the format (mantissa x 2^exponent)

29
Q

How would 7.25 be recorded in normalised floating point

A

7.25 = 7¼

16 8 4 2 1 . ½ ¼ ⅛
0 0 1 1 1 . 0 1 0

Therefore 7.25 = 00111.010

Now write this number straight into the mantissa but ignore the leading 0s. The first 2 digits of the mantissa are always different. Fill in remaining digits of mantissa with zeros.

30
Q

What is truncation

A

Number is approximated to the whole number/tenth/hundredth etc. That is nearer to zero

I.e. number is always rounded down

31
Q

What is truncation used for

A

For dealing with situations where there are not enough bits to represent all of the number to be stored. The extra bits are just missing off

E.g. 0.0101101 would be stored in 4 bits as 0.010

32
Q

How do you calculate absolute error

A

Original - truncated = answer

33
Q

How do you calculate the relative error

A

Absolute error/original = answer%

34
Q

What is rounding

A

Number is approximated to nearest whole number

If digit after last digit in binary is to be represented is a 1, then the previous digit is increased by 1. Therefore:

Original: 0.0101101
New: 0.011

35
Q

Overflow

A

Occurs when a number is too large to be stored satisfactorily by the computer

36
Q

When can overflow occur

A

When ghe results of a computation is too large to be represented in the system

E.g. multiplying a large number by a large number

37
Q

Underflow

A

Occurs when the result of a computation is close to zero, and is too small to be represented in the system and becomes 0 instead.

E.g. ⅛ x ¼ is 0.001 x 0.010 = 0.00001 I.e. 1/32