Data Representation Flashcards

(45 cards)

1
Q

What are electronic computers (except ENIAC) based on?

A

Based on two state devices:

transistors and logic gates.

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

What are 2 state devices

A

Devices that can only be in one of two conditions at any time e.g. on/off, yes/no, 1/0

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

In two-state representation, what do we need to distinguish between electronically?

A

Electronically, we need to distinguish only between, for example:

Voltage and no voltage
Current and no current
Switch on and off
Electrical pulse and no electrical pulse

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

What are numeration systems?

A

All numeration systems are representational — i.e. a form of coding.

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

What type of notation does the decimal numeral system have?

A

The decimal numeral system has a positional notation.

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

How do you convert from decimal to binary

A
  1. Divide the number by two and if it is not divisible by 2 then write a 1 beside it, otherwise a 0.
  2. Divide the new number by 2
  3. Repeat until you get to 0. (When you get to 1, it counts as a 1 not 0 AND NO NUMBER NEEDED FOR WHEN YOU ARE AT 0)
  4. Write the combinations of 1’s and 0’s from bottom to top to get the binary code.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you convert from binary to decimal

A
  1. Write out the binary code from left to right.
  2. Start from the right hand side and do 2^0, 2^1, 2^n.
  3. Multiply the numbers from the previous steps by the binary number 1/0 assigned to it and then add up all the numbers.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does subscript 10 and subscript 2 mean

A

10 - represents the decimal system
2 - represents the binary system

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

What are the rules when doing binary addition

A

0 + 0 = 0
1 + 0 = 1
1 + 1 = 0 and carry the 1 onto the next column
1 + 1 + 1 = Write 1 and carry 1

When you have 1 + 1 and have a carried on 1, you write 1 and carry the other 1.

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

What are the rules when doing binary subtraction

A

0 - 0 = 0
1 - 0 = 1
1 -1 = 0
0 - 1 = 1 because you borrow 1 from the next column so the zero essentially becomes a 2.

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

How can the two states of a collection of two-state devices be used?

A

The two states of a collection of two-state devices can be used to encode a number in binary representation.

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

What do computer systems do with two-state devices?

A

Computer systems use the two states of two-state devices to encode numbers in binary representation — this is exactly what happens in computer systems!

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

How many bit pattern can a cell of n bits hold

A

2^n bit pattern

Each bit has 2 possibilities so we do 2x2x2 n number of times which is the same as 2^n

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

How many different numbers can we store in a byte

A

256 different numbers, from 0 to 255

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

What is Binary-Coded Decimal (BCD)?

A

Binary-Coded Decimal (BCD) is a system where decimal digits are coded directly as 4 bits.

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

What is Binary-Coded Sexagesimal and how many bits does it use?

A

Binary-Coded Sexagesimal uses 6 bits to represent values in sexagesimal (base 60), like in time.

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

What are Gray Codes (reflected binary code)?

A

Gray Codes, or reflected binary codes, are codes in which successive values differ in only a single digit.

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

What are the three main representations of signed integers?

A

The three main representations of signed integers are:

Sign and Magnitude
One’s Complement
Two’s Complement

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

How do we represent integers from -(2^n - 1) to (2^n -1) in a cell of n+1 bites in sign and magnitude

A

The first bit represents the sign of the integer - 0 is positive and 1 is negative

The remaining n bits represent the magnitude (using normal binary)

20
Q

What are the advantages of sign and magnitude

A

Easy to read
Symmetric about 0

21
Q

What are the disadvantages of using sign and magnitude

A

There are 2 representations of 0
Only 255 values are represented in a cell
Arithmetic becomes unnecessarily complicated - there are cases for each combination of signs.

22
Q

How do we represent integers using 1’s complement

A

Positive integers are represented by adding a leading 0.

Negative integers are represented by swapping 1’s and 0’s in n. The leading bit still represents the sign

23
Q

Advantages and disadvantage of 1’s complement

A

Simplifies arithmetic, but it leaves us with 2 representations of 0.

24
Q

How does 2’s complement represent integers

A

Like 1’s complement, we represent -n by swapping 0’s and 1’s in n, and then binary adding 1

E.g. Step 1: Write 6 in binary
6 = 00110

Step 2: Invert all bits (change 0 to 1 and 1 to 0)
00110 → 11001

Step 3: Add 1 using normal binary addition
11001 + 1 = 11010

Final answer:
−6 = 11010

25
How to turn -37 into 2's complement
1. +37 = 00100101 2. 00100101 -> 11011010 3. 11011011
26
How many representations of zero are there in two’s complement?
1
27
In two’s complement, what does a 1/0 in the most significant bit position indicate?
A 1 in the leftmost (“most significant”) bit indicates the number is negative and a 0 means positive
28
Is the number line symmetrical about 0 in two’s complement representation?
No. The number line is not symmetrical because there is one more representation of negative numbers than positive numbers.
29
What is the advantage of arithmetic in 2’s complement representation?
Arithmetic on signed numbers can be carried out in one step — we don’t need to worry about sign and magnitude separately.
30
In 2’s complement, why is addition and subtraction straightforward?
Once we can handle signed numbers, we can do subtraction as well as addition using the same binary operations.
31
Give an example of adding +7 and -3 in 2’s complement (in binary).
00000111 = +7 11111101 = -3 00000100 = +4 REMEMBER ONLY NEED TO DO +1 AND SWITCH 1'S AND 0'S WHEN MAKING A POSITIVE NUMBER NEGATIVE.
32
How do we store character data?
We give a unique bit pattern to each character.
33
How many bit patterns are used for upper and lower case letters?
26 patterns for upper case letters, and 26 patterns for lower case letters.
34
Why can individual characters usually be stored within a single byte?
Because fewer than 128 bit patterns are usually sufficient.
35
How are strings stored?
Strings of characters can be stored in a succession of bytes.
36
What does ASCII stand for and how many bits does it use?
ASCII = American Standard Code for Information Interchange, and it uses 7-bit representation.
37
What does UNICODE provide compared to ASCII?
UNICODE (32-bit) can represent over 2 billion characters, including alphabets in different languages, emojis, symbols, etc.
38
Why was UTF-8 created?
To have backward compatibility with ASCII and avoid wasted space.
39
What kind of character encoding is UTF-8?
UTF-8 is a variable-width character encoding.
40
Why do we use octal or hexadecimal notation for binary numbers?
Writing or displaying binary directly is tedious, so we use octal (base 8) or hexadecimal (base 16) for convenience.
41
Which digits does octal notation use?
0, 1, 2, 3, 4, 5, 6, 7.
42
Which digits does hexadecimal notation use?
Hexadecimal uses 0–9 and A, B, C, D, E, F.
43
How many bits does one octal digit correspond to?
One octal digit corresponds to three bits.
44
How many bits does one hexadecimal digit correspond to, and what is it also called?
One hexadecimal digit corresponds to four bits, also known as a nibble.
45
How to go from decimal to BCD
Split the number into each number (where possible) e.g. 58 into 5 and 8. Make each number using only 8,4,2,1. E.g. 5 = 4 + 1 and 8 = 8 so 5 = 0101 and 8 = 1000 Put a 1 when the number is present and a 0 where not