Data Representation Flashcards

1
Q

Convert 10101011 from binary to decimal

A

-Write the column headings over each binary digit, add up the columns with a 1 under them.
(128) (64) (32) (16) (8)(4) (2) (1)
1 0 1 0 1 0 1 1

128+32+8+2+1 = 171

Answer: 10101011 = 171

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

Convert 5 from decimal to binary

A

(128) (64) (32) (16) (8)(4) (2) (1)
0 0 0 0 0 1 0 1 (4+1 = 5)

Answer = 00000101

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

Convert 00110001 from binary to hexadecimal

A

-split each part into 4 digit chunks
(8) (4) (2) (1) (8) (4) (2) (1)
0 0 1 1 0 0 0 1
2+1 = 3 = 1

-Combine both digits

3 and 1 = 31

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

Convert 10101110 from binary to hexadecimal

A

-split each part into 4 digit chunks
(8) (4) (2) (1) (8) (4) (2) (1)
1 0 1 0 1 1 1 0
8+2 = 10 8+4+2 = 14

-In hexadecimal if the number is above 9 it goes into the alphabet
(A) (B) (C) (D) (E) (F)
10 11 12 13 14 15

Therefore 10 = A and 14 = E

-Combine both digits
A and E = AE

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

how the addition in 8 bit binary of 57+28

A
57 = 00111001
28 = 00011100

-Use the column method to add them together. If one column’s result is either 2 or 3, then the first bit is carried over to the next column.

Answer: 01010101

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

What is a bit?

A

a bit is a binary digit (0 or 1)

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

What is a byte?

A

a byte is a collection of 8 bits

it can be used to represent a character (e.g. letter of the alphabet) e.g. the letter “A” is represented by 01000001, “B” is 01000010 (using the ASCII character set)

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

What is word size?

A

The word size is the number of bits that the processor can deal with in a single operation. For example a 64 bit PC has a word size of 64 bits (or 8 bytes)

This is why a 64 bit computer is considerably faster than a 32 bit computer.

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

What is decimal?

A

Base 10. Decimal uses characters 0 through 9.

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

What is binary?

A

Base 2. Binary consists of 2 symbols, 0 and 1. This can be represented electronically as On/Off or Voltage/No voltage

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

Arithmetic: Binary Addition

A

Works the same as standard addition.

Each bit is added together and if the result is 2(10 in binary) or 3 (11) 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
12
Q

What is hexadecimal?

A

Base 16. Hex uses characters 0 through F.

10 - 15 in decimal is A - F in hexadecimal.

Hexadecimal is much easier to read/write than binary. It is used as it keeps numbers much shorter but is also very easy to convert to and from binary.

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

How do you convert binary to hexadecimal?

A
  • Starting from the right and working left, split the binary number into groups of 4 bits. If the last group has less than 4 bits, simply fill in with 0s from the left.
  • Convert these groups into the equivalent hexadecimal digit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is sign and magnitude?

A

A method for recording signed integers.

The left-most bit (most significant bit) is used as a sign-bit. If it is zero then the number is positive, if it is a one then the number is negative.

e.g. write -12 as an 8-bit sign and magnitude binary number:

We know that 12 is 00001100

Therefore -12 is 10001100 (the first 1 being the sign bit).

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

What is the range of numbers that can be stored in 8 bits when using sign and magnitude?

A

As one bit is being used as a sign bit, the range of numbers that can be stored in 8 bits is -127 to +127.

In unsigned binary the range would have been 0 to +255

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

What is two’s complement?

A

is an alternative to sign and magnitude and is more often used in the real world.

The most significant bit is used as a sign bit.

e.g. Write -44 as an 8-bit 2’s complement binary number

We know that 44 is 00101100

To make this negative we “take the 2s complement”. i.e. start at the right hand side of the number, copy each bit up to and including the first 1 and then reverse the rest.

Therefore -44 is 11010100 in 2’s complement.

(the range of numbers that can be held in 8 bits 2’s complement is -128 to +127)

17
Q

Binary Arithmetic: Subtraction

A

is an alternative to sign and magnitude and is more often used in the real world.

The most significant bit is used as a sign bit.

e.g. Write -44 as an 8-bit 2’s complement binary number

We know that 44 is 00101100

To make this negative we “take the 2s complement”. i.e. start at the right hand side of the number, copy each bit up to and including the first 1 and then reverse the rest.

Therefore -44 is 11010100 in 2’s complement.

(the range of numbers that can be held in 8 bits 2’s complement is -128 to +127)

18
Q

What are ranges?

A

Considering we have 8 bit unsigned binary (i.e. no negatives allowed)

Smallest value: 00000000 (0)

Largest value: 11111111 (255)

Range is 0 to 255 (256 different values)

Considering 8 bit signed 2s Complement binary

Smallest Value: 10000000 (-128)

Largest Value: 01111111 (+127)

Range is -128 to 127 (256 different values). So we can still hold 256 values but we’ve shifted the range down to allow negatives.

Considering 8 bit Sign and Magnitude binary

Smallest value: 11111111 (-127)

Largest value: 01111111 (+127)

Range is -127 to +127 (255 different values). We’ve ‘lost’ a value because there are two ways of storing 0. (-0 and +0)

10000000 = -0

00000000 = +0

19
Q

What is a logical shift left?

A

Before: 10011011

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

After: 00110110

20
Q

What is a logical shift right?

A

Before: 10011011

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

After: 01001101

21
Q

What is an arithmetic shift right?

A

Before: 10011011

All bits move right, bit falls off the end and a 1 appears in its place to keep same sign bit

After: 11001101

Another example:

Before: 01011011

All bits move right, bit falls off the end and a 0 appears in its place to keep same sign bit.

After: 00101101

22
Q

What does an arithmetic shift do to decimal numbers?

A

Before: 00100101 (37 in decimal)

Do an arithmetic shift left

After: 01001010 (74 in decimal)

Therefore Arithmetic Shift Left multiplies a number by 2 (shift twice to multiply by 4, three times for 8 etc.)

Before: 01001100 (76 in decimal)

Do an arithmetic shift right

After: 00100110 (38 in decimal)

Therefore Arithmetic Shift Right divides a number by 2 (shift twice to divide by 4, three times to divide by 8 etc.)

Also works with negative 2’s complement numbers

Before: 11100100 (-28)

Arithmetic shift to right

After: 11110010 (-14)

23
Q

Binary Arithmetic:Multiplication

A

6:30 on https://web.microsoftstream.com/video/1bfe4f00-1565-4bff-a067-c4ee633b4d55?channelId=9bcee16e-d1b8-4f3f-8ced-80fb4db4cb9c

24
Q

How do we convert decimal fraction to binary fraction?

A

https://web.microsoftstream.com/video/673b6801-0f15-4278-8620-5243327d6827?channelId=9bcee16e-d1b8-4f3f-8ced-80fb4db4cb9c

25
Q

What is standard form in binary called

A

Normalised floating point

mantissa x 2^(exponent)

26
Q

write 011101 in normalised floating point

A

mantissa x 2^(exponent)

011101 can be written as 0.11101 x 2^(5)

5 = 0101

= 0.11101 x 2^(0101)

27
Q

What is a floating point?

A

can store numbers which are not integers (i.e. real numbers with fractional parts)

28
Q

What is truncation?

A

a number which is approximated to the whole number/tenth/hundredth that is nearer to 0. i.e. Number is always rounded down.

This method is used to deal with situations where there are not enough bits to represent all of the number to be stored. The extra bits are just missed off. E.g. 0.0101101 would be stored in 4 bits as 0.010

The exam board may ask you to calculate the absolute and relative truncation errors by converting them into decimal/denary first. Using the same example:

Original: 0.0101101 = 0.351563

Truncated: 0.010 = 0.25

Absolute error = Original - New:

0.351563 - 0.25 = 0.101563

Relative Error: Absolute/Original:

0.101563/0.351563 = ~28.89%

29
Q

What is rounding?

A

Number that is approximated to the nearest whole number/ten/hundredth etc.

similar to truncation but tries to get a little closer to the original value

In binary, if the digit after the last digit to be represented is a 1, then the previous digit is increased by 1.

Original: 0.0101101 = 0.351563

Stored in 4 bits is

0.011 = 0.375

Absolute error: Original - New = 0.351563 - 0.375 = -0.0234375

Relative error: Absolute/Original = -0.0234375/0.351563 = ~-6.67%

30
Q

What is the difference between rounding and truncating?

A

Exam board prefers to see decimal examples

  1. 78 rounded to 1 decimal place is 231.8
  2. 78 truncated to 1 decimal place is 231.7
31
Q

Why can rounding or Truncation cause problems in computer calculations?

A

Rounding or truncation can cause problems in computer calculations because successive minor rounding/truncation errors can combine to become significant. E.g. if bank calculations always round down to the nearest penny all those fractions of a penny can add up to a significant amount.

32
Q

What’s an advantage of ascii

A

Enables computer systems to communicate with eachother easily