Section 3 - Fundamentals of Data Representation

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/188

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

189 Terms

1
New cards

What does ASCII stand for?

American Standard Code for Information Interchange

2
New cards

What does ASCII do?

It allows every character to be represented as a 7-bit binary pattern, allowing 128 different characters to be represented

Eg. A is represented by 1000001, same binary code as the decimal no. 6
3
New cards

What are the pseudocode funtions for casting to and from ASCII?

"CHAR_TO_CODE(""A"") evaluates to 65
CODE_TO_CHAR(66) evaluates to ""B"""
4
New cards

What are the python functions for casting to and from ASCII?

"chr(66) will return the character represented by 66
ord(""A"") will return the code that represents ""A"""
5
New cards

In ASCII code, is a lowercase letter worth more or less than an uppercase one?

"More ""a"" > ""A"""

6
New cards

In ASCII code, is a letter further in the alphabet worth more or less than an earlier one?

"More

""Z"" > ""A"""
7
New cards

How do you work out the binary and ASCII codes for a letter?

"64 32 | 16 8 4 2 1
1 0 | 0 0 0 0 1 Putting 10 at the start means it is an uppercase letter, putting 11 means it is a lowercase letter
1 1 | 0 0 0 0 1

The numbers to the right of the line are always the same - they always add up to the position of the letter in the alphabet

All the numbers (on both sides of the line) added together will make the ASCII code of that letter

""A"" = 1000001 = 64 + 1 = 65
""a"" = 1100001 = 64 + 32 + 1 = 97"
8
New cards

How do computers work?

By turning switches on/off to allow electricity to flow or not

9
New cards

What happens if a switch is on?

It's closed and electricity flows (state of 1)

10
New cards

What happens if a switch is off?

It's open and no current will flow (state of 0)

11
New cards

What are the 2 states a switch can be in?

1 or 0 - binary

12
New cards

What is a single 0/1 called?

A bit (Binary digIT)

13
New cards

What is base 10?

Denary/decimal

As we go up in 10s when counting
1s --> 10s ----> 100s
14
New cards

What is 1 byte?

8 bits

15
New cards

What is a byte?

The smallest addressable unit of memory in a computer (8 bits)

16
New cards

What is a nibble?

4 bits (half a byte)

17
New cards

What is a kilobyte (kB)?

1,000 bytes (10^3)

18
New cards

What is a megabyte (MB)?

1,000,000 bytes (10^6) = (1,000KB)

19
New cards

What is a gigabyte (GB)?

1,000,000,000 bytes (10^9) = 1,000MB

20
New cards

What is a terabyte (TB)?

1,000,000,000,000 bytes (10^12) = 1,000GB

21
New cards

What is a petabyte (PB)?

1,000,000,000,000,000 bytes (10^15) = 1,000TB

22
New cards

How do you convert from binary to denary?

128     64     32     16    8    4     2   1


If there is a 1 in the column, then the number above is added to the total
If there is a 0, then add nothing
23
New cards

Convert 67 into binary

01000011

24
New cards

Convert 01100001 into denary

97

25
New cards

What does internal memory often use instead of MB,KB,etc...

Powers of 2:
KiB (kibibyte), MiB (mebibyte), GiB (gigibyte)
26
New cards

What is a kibibyte?

2^10 = 1,024 bytes

27
New cards

What is a mebibyte?

2^20 = 1,048,576 bytes

28
New cards

What is a gibibyte?

2^30 =  1,073,741,824 bytes

29
New cards

What do computers use the binary system for?

To store numbers and perform binary arithmetic and logic operations

30
New cards

What is the memory size of secondary storage systems commonly measured in now?

Terabytes (TB)

31
New cards

The more bits we use...

The more possible values they can store

eg. 2 bits can store 4 possible values, while 3 bits can store 8 possible values
32
New cards

What is the no. of different values that can be represented in n bits?

2^n

Eg. to represent 17 values, you will need 5 bits (2^5) - (2^4 is too little)
33
New cards

What is the highest no. we can store in n bits?

2^n - 1
(the number of different values that can be represented - 1)
34
New cards

How many bits would be required to encode every letter of te alphabet in upper & lower case?

52 letters ---> 2^6 = 64
6 bits needed
35
New cards

How many different colours could be stored if we encoded each colour in 8 bits?

2^8 = 256 colours

36
New cards

How many bits would we need to store each pixel if we needed 16 million different possible colours?

2^n = 16,000,000+
n = 24 bits
37
New cards

If every colours is represented by a total of 24 bits, how many different colurs can be stored in this way?

2^24 colours

38
New cards
What are the rules of binary addition?
1+0=
0+1=
1+1=
1+1+1=
1+0=1
0+1=1
1+1= Write 0, carry 1
1+1+1= Write 1, carry 1
39
New cards
<p></p>

""
"<img src=""image286160423399614733.jpg"">"
40
New cards

What happens if you add 2 binary numbers together that result in a number bigger than 255?

It will need 9 bits - causing overflow

41
New cards

What is overflow?

A computer stores things in memory with a finite amount of space

If you can't represent this no. in that amount of space, then overflow accurs

(Eg. if u try to use 8 bits to store a 9 bit - overflow error as 9th bit doesn't fit in 1 byte allocation)
42
New cards

How do you double a binary number?

"Shift the bits 1 space to the left (a bit may ""fall off"" the end of the byte)

Put a 0 in empty spaces"
43
New cards
<p>"Multiply this binary number by 2</p>

"Multiply this binary number by 2

<p></p>
44
New cards

How can you check binary arithmetic?

Convert into denary

45
New cards

How do you divide a binary number by 2?

"Shift all the bits 1 space to the right (a bit may ""fall off"" the end of the byte)

Fill any gaps with a 0"
46
New cards
"Divide this binary number by 2:<br><img src=""image2724863666753441664.jpg"">"
"Divide this binary number by 2:
"
""
"<img src=""image7189020054287897451.jpg"">"
47
New cards

What is the smallest value you can hold in a nibble?

0000

48
New cards

What is the largest value you can hold in a nibble?

1111

49
New cards

What is hexadecimal?

Base 16 

50
New cards

What is base 16?

A way of representing the decimal values 0-15 with a single digit

51
New cards

How is 0-15 represented in a single digit if we only have 0-9 numbers?

We use letters A-F to get up to 15

52
New cards

How do you convert from hexadecimal to denary?

Take the first number/letter and multiply it by 16, then add on the second number/letter

53
New cards

What is A-F in denary?

10,11,12,13,14,15

54
New cards

Convert 10 in hex to denary

(1 x 16) + 0 = 16

15 is the biggest number u can have with 4 bites - 16 is 1 group of 16 and no units
55
New cards

Why do we use hex and not double digits in denary?

We needed to find a way to represent every group of 4 bits with a single digit (the largest number that u can store in 4 bits is 15 so we need to go up to 15)

56
New cards

Convert A7 to denary

A = 10

(10 x 16) + 7 = 167
57
New cards
How do you convert from binary to hexadecimal?
Try 0101 1100
"If it is 8 bits, split into 2 nibbles

Then convert each nibble to denary and substitute for the hex values

Eg.
0101 = 5    1100 = 12
5 in denary = 5 in hex
12 in denary = C in hex
Therefore it is 5C
"
58
New cards
How do you convert from decima to hexadecimal?
Try 182
Divide the decimal no. by 16
Convert this result into hex
Then take the remainder and convert into hex

Eg. 182
182/16 = 11 remainder 6
11 = B in hex
6 = 6 in hex
Therefore 182 = B6
59
New cards

How do you convert from hexadecimal to binary? Try A7

Convert each hex digit into a nibble

Eg. A = 10

A ---> 1010
7 ----> 0111
A7 = 10100111
60
New cards

What are the advantages of hexadecimal?

Hex is used because it is quicker to write, quicker to type, and
quicker to decode than binary. It also takes less space on the
page when written down
61
New cards

What is hex used for?

Picking numbers for a graphic

In assembly language instructions (eg. ADD & 4F3A)
62
New cards

When using hex, remember...

YOUR COMPUTER DOES NOT USE HEX, IT IS STILL STORED AS BINARY AND TAKES UP THE SAME AMOUNT OF SPACE IN MEMORY

63
New cards

What does ASCII stand for?

American Standard Code for information Interchange

64
New cards

How many bits does ASCII use per character?

7

65
New cards

How many different characters can be represented in the ASCII character set?

128 characters (0-127) (2^n - 2^7)

66
New cards

How are the character codes grouped and run?

"In sequence

(eg. if 'A' is 65, then 'C' must be 67)
(eg. since ""7"" is 55, ""9"" must be 57)"
67
New cards

"""7"" < ""9"" or ""7"" > ""9""?"

"""7"" < ""9"""

68
New cards

Why can't you calculate with numbers that are input as strings?

"The ASCII code value for a number is different from the pure binary value of that number

eg. ""5"" = 0011 0101 but 5 = 0000 0101"
69
New cards
How many bits does the extended ASCII character set use?
How many characters can it represent?

8 bits (so can represent 256 characters in total)

70
New cards

What do the extra characters in extended ASCII do?

They're used for characters from foreign languages and special symbols

71
New cards

What is unicode?

A character set which is the new standard for representing the characters of all the languages of the world

72
New cards

How many bits does unicode use per character?

Between 8, 16 or 32 bits per character

73
New cards

What are the advantages of unicode?

- Provides a unique standard for all the world's writing systems
- Allows for mulilingual text in any language
74
New cards

Why is unicode better than ASCII?

It can represent many more unique characters than ASCII because of the large no. of bits avaialble to store a character code

75
New cards

Does Unicode use any of the same codes as ASCII?

Yes, up to 127

76
New cards

What is a character set?

A character set is a list of characters that are recognised by the computer, along with the binary codes to represent them

77
New cards

Where do the ASCII capital letters start?

At 65

78
New cards

Where do the ASCII lowercase letters start?

At 97

79
New cards

What do you do to convert from upper to lowercase in ascii?

Add 32 to the ASCII code

80
New cards

If you are ever asked to calculate how many bits are needed to store a sentence in ASCII...

multiply the number of characters (including spaces) by 7

81
New cards

Although ASCII uses 7 bits per character....

The computer will use a full byte to store each character.  

For this reason, the size of a text file IN REAL LIFE (NOT FOR THE EXAM) will be the same as the number of characters contained within it.  Don’t forget to include spaces in the count though!
82
New cards

Which characters are the same in ASCII and Unicode?

For compatibility reasons, and because ASCII came first, the first 128 UNICODE characters are the same as the ASCII characters.

83
New cards

Why is Unicode used?

Unicode is used because it enables the characters from all the worlds writing systems to be encoded

84
New cards

What is the disadvantage of Unicode?

It has a disadvantage in that files that include Unicode text will be bigger than files using ASCII. This is because UNICODE uses more bits for each character.

85
New cards

What is a pixel (picture element)?

The single point in an image, which can have its colour set independently

86
New cards

What is a bitmap?

A set of bits that represents a graphical image, which each bit (or group of bits) corresponding to a pixel in the image

87
New cards

Photos taken with digital cameras are...

Bitmap images

(some bitmap images have the file extension bmp)
88
New cards

What is the resolution of an image?

The number of pizels in each dimension that can be displayed (usally represented as 2 numbers eg. 600 x 400)

89
New cards

For printers, the resolution is..

The number of pixels or dots per square inch that cna be printed (dpi)

90
New cards

What is the colour depth?

The number of bits used to encode the colour of each pizel

91
New cards

A higher colour depth will enable...

pictures with a larger range of colours to be encoded

92
New cards

How do you calculate the number of colours that can be represented with the colour depth?

"2**n

Eg. for up to:
2 colours (2^1)
93
New cards

What is each pixel represented by?

A binary code to represent the colour of the pixel

94
New cards

What is metadata?

The information about the image which is encoded within the bitmap file

95
New cards

What is included in the metadata?

- File type, date created, author

- Height and width
- Resolution
- Colour depth
96
New cards

If only 1 bit is used to encode each pixel...

The only colours will be black or white

97
New cards

The number of bits used to encode the colour of each pixel...

detemines the quality of the image

98
New cards

How is black/white represented in a bit?

1 (pixel on) for white and 0 (pixel off) for black

99
New cards

What is true colour?

The term used to describe a colour depth of 24 bits - giving 2^24 different colours

100
New cards

How many bits used to represent each component of the colour in true colour?

1 byte (8 bits) is used to represent each of the RGB components of the colour