3.3 Data Rep Flashcards
How is all data stored in a computer (2 marks)
- In a computer, all data is stored in binary form.
- A binary digit has two possible states, 1 and 0.
What base is binary
Base 2
What is data - simply (3)
- Units of information
- In computing there can be different data types, including integers, characters and Boolean. - Data is often acted on by instructions.
Binary digit:
- name
- how big
A binary digit is known as a bit.
A bit is the smallest unit of data a computer can use
What can a bit be
0 or 1
Symbol of a bit
b (lower case b)
How many bits in a byte
A byte if a group of 8 bits
What is the fundamental unit of information
A bit
Symbol of byte
B (upper case B)
All the quantities in the binary unit system :
8 bits 1 byte (B)
1,000 bytes (1,000 B) 1 kilobyte (KB)
1,000 kilobytes (1,000 KB) 1 megabyte (MB)
1,000 megabytes (1,000 MB) 1 gigabyte (GB)
1,000 gigabytes (1,000 GB) 1 terabyte (TB)
1,000 terabytes (1,000 TB) 1 petabyte (PB)
What’s a nibble?
Four bits or half a byte is known as a nibble.
When calculating storage space for disk drives, it is common to use multiples of __.
These are shown in the table above as ?
When calculating storage space for disk drives, it is common to use multiples of 1,000. These are shown in the table above as kilobytes, megabytes etc.
Decimal system is base what?
10
The digits in the decimal system:
0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
How computers use decimal numbers
Decimal numbers must be converted into their binary equivalent before a computer can use them.
Denary
Decimal
The first eight binary place values are:
128 64 32 16 8 4 2 1
binary number 1111100
In decimal?
128 64 32 16 8 4 2 1
0 1 1 1 1 1 0 0
Result - (0 × 128) + (1 × 64) + (1 × 32) + (1 × 16) + (1 × 8) + (1 × 4) + (0 × 2) + (0 × 1) = 124
What would these binary numbers be in decimal?
1001
10101
11001100
9
21
204
In words - to convert binary to decimal…
To convert binary to decimal, simply take each place value that has a 1, and add them together.
In words, to convert decimal to binary…
To convert from decimal to binary, start by subtracting the biggest place value possible from the decimal number, then place a 1 in that place value column. Next, subtract the second biggest place value possible, and place a 1 in the column. Repeat this process until zero is reached. Finally, place a 0 in any empty place value columns.
84 in decimal in binary?
Result - 84 in decimal is 01010100 in binary.
To check that binary conversion is right?
To check that this is right, convert the binary back to decimal:
(0 × 128) + (1 × 64) + (0 × 32) + (1 × 16) + (0 × 8) + (1 × 4) + (0 × 2) + (0 × 1) = 84
Alternative way to convert a decimal number to binary
Another way to convert a decimal number to binary is to divide the starting number by two. If it divides evenly, the binary digit is 0. If it does not and there is a remainder, the binary digit is 1. Finally, reverse the digits and you have the correct number.
What would these decimal numbers be in binary?
12
42
188
1100
101010
10111100
When two numbers are added together in decimal, we take the first number, add the second number to it, and get an answer. For example, 1 + 2 = 3.
When we add two binary numbers together the process is different.
There are four rules that need to be followed when adding two binary numbers. These are:
0 + 0 = 0
1 + 0 = 1
1 + 1 = 10 (binary for decimal 2)
1 + 1 + 1 = 11 (binary for decimal 3)
adding 01010011 + 01110110
1 + 0 = 1
1 + 1 = 0, carry 1
1 + 0 + 1 = 0, carry 1
1 + 0 + 0 = 1
1 + 1 = 0, carry 1
1 + 0 + 1 = 0, carry 1
1 + 1 + 1 = 1, carry 1
1 + 0 + 0 = 1
Result in binary - 11001001 (which is decimal 201). You can check your answers by converting each binary number into decimal and checking your addition. In this example, 01010011 is 83 in decimal and 01110110 is 118 in decimal. So, 83 + 118 is 201.
Overflow:
When does unit occur?
Overflow occurs when the result of a calculation requires more bits - place values - than are in the available range.
Example of an overflow error?
For example, when using eight bits, the largest number that can be recorded is 11111111 (decimal 255). When adding together two eight-bit numbers, a situation may occur when the result requires more than eight bits to hold it. For example, adding the binary numbers 11111110 (decimal 254) and 00000010 (decimal 2) would give:
Binary addition: 1 1 1 1 1 1 1 0 plus 0 0 0 0 0 0 1 0 equals 0 0 0 0 0 0 0 0
The result is actually 10000000 (decimal 256), which requires nine bits. However, as only eight bits are available to hold the number, the result would be 00000000 (decimal 0).
Consequences of overflow? - key word
The answer refers to last card
As you can see, overflow can have serious consequences for the validity of calculations.
How are binary numbers multiplied and divided - name
Binary shifts
Binary numbers are multiplied and divided through a process called shifting.
Multiplication
To multiply a number, a binary shift moves all the digits in the binary number along to the __ and (does what with the gaps?)
- to multiply by two, ?
- to multiply by four, ?
- to multiply by eight, ?
Multiplication
To multiply a number, a binary shift moves all the digits in the binary number along to the left and fills the gaps after the shift with 0:
- to multiply by two, all digits shift one place to the left
- to multiply by four, all digits shift two places to the left
- to multiply by eight, all digits shift three places to the left
and so on
1100 (decimal 12) × 2
Result - shifting one place to the left gives 11000 (decimal 24)
Example - 10110 (decimal 22) × 4
Result - shifting two places to the left gives 1011000 (decimal 88)
Quick note for binary addition on the spec - regarding what maximum number of bits for exam
‘answers will be a maximum of 8 bits in length and will not involve carrying beyond the 8th bit’
Shifting left by n bits on a signed or unsigned binary number has the effect of multiplying it by __.
Shifting left by n bits on a signed or unsigned binary number has the effect of multiplying it by 2^n.
To divide, the digits are moved one place to the __, and the rightmost digit (?).
To divide, the digits are moved one place to the right, and the rightmost digit is discarded.
Effect of losing digits in right binary shift - key word
losing precision. It can happen with too much shifting.
Too much division means losing precision
The number is divided by 4
Loss of accuracy …
… the bits on the right are removed
What is the name of the binary shift we do in gcse
Logical binary shift
Hexadecimal
- what base
- how many units
- what are the units
Base 16
Hexadecimal, also known as hex, is the third commonly used number system.
It has 16 units - 0-9 and the letters A, B, C, D, E and F.
Decimal vs binary vs hex
0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F
Why is hex useful (2), with examples
Hex is useful because large numbers can be represented using fewer digits. For example, colour values and MAC addresses are often represented in hex.
Additionally, hex is easier for humans to understand than binary. Programmers often use hex to represent binary values as they are simpler to write and check than when using binary.
Does hex save memory? Why?
Hex does not save memory as it must be converted to binary for the computer to understand it.
What powers are hex place values - with examples of the first 5
Whereas decimal place values are powers of 10, and binary place values are powers of 2, hex place values are powers of 16.
65,536 4,096 256 16 1
HEX:
Each place value can be represented by the units ?
Each place value can be represented by the units 0 through to F.
Hex to decimal ?
hex number 7C
65,536 4,096 256 16 1
——————————. 7 C
(7 × 16) + (C × 1) = (7 × 16) + (12 × 1) = (112) + (12) = 124
What would these hex numbers be in decimal?
11
2B
FA
17
43
250
In words - to convert from decimal to hex (2)
- If the decimal number is bigger than 16, divide it by 16. Take the hexadecimal equivalent of this result - this represents the first digit. Take the hexadecimal equivalent of the remainder - this represents the second digit.
- If the decimal number is smaller than 16, take the hexadecimal equivalent of the decimal number.
Example - convert decimal 22 to hexadecimal
16 goes into 22 once with 6 left over, so 22 ÷ 16 = 1 remainder 6
1 = hex 1
6 = hex 6
Result - 16
Example - convert 138 to hexadecimal
138 ÷ 16 = 8 remainder 10
8 = hex 8
10 = hex A
Result - 8A
Binary to hex - in words (4)
- Start at the rightmost digit and break the binary number up into groups of four digits. These are known as nibbles. If there are less than four digits, use just that number of digits for that group.
- Next, convert each group of four digits into decimal.
- Convert each decimal value into its hex equivalent.
- Put the hex digits together
Example - 1101 to hex
1101 = decimal 13
13 = hex D
Result - D
Example - 11000011 to hex
Break into groups of four - 1100 0011
1100 = decimal 12 0011 = decimal 3
12 = hex C 3 = hex 3
Result - C3
Example - 110011 to hex
Break into groups of four - 0011 0011. In this example, extra 0s are added at the highest values to create two groups of four bits.
0011 = decimal 3 0011 = decimal 3
3 = hex 3 3 = hex 3
Result - 33
Hex to binary - steps in words (4)
- Split the hex number into individual values.
- Convert each hex value into its decimal equivalent.
- Next, convert each decimal digit into binary, making sure to write four digits for each value.
- Combine all four digits to make one binary number.
Example - hex 28 to binary
Example - hex 28 to binary
2 = decimal 2 8 = decimal 8
2 = binary 0010 8 = binary 1000
Result - 00101000
Example - hex FC to binary
F = decimal 15 C = decimal 12
15 = binary 1111 12 = binary 1100
Result - 11111100
hat would these hex numbers be in binary?
11
2B
AA
00010001
00101011
10101010
all characters, whether they are letters, punctuation or digits are stored as ?
+ why
Computers work in binary. As a result, all characters, whether they are letters, punctuation or digits are stored as binary numbers.
Character set?
All of the characters that a computer can use are called a character set.
Two standard character sets in common use are: (In full names)
Two standard character sets in common use are:
- American Standard Code for Information Interchange (ASCII)
- Unicode
ASCII-
- how many bits?
- character set size?
- what this includes?
ASCII uses seven bits, giving a character set of 128 characters. The characters are represented in a table, called the ASCII table. The 128 characters include:
32 control codes - mainly to do with printing
32 punctuation codes, symbols, and space
26 upper case letters
26 lower case letters
ASCII - A
65
ASCII - Z
90
ASCII - a
97
ASCII - z
122
ASCII - 0
48
ASCII - 9
57
When data is stored or transmitted, what is used
+ example - the word ‘computer’
When data is stored or transmitted, its ASCII or Unicode number is used, not the character itself.
For example, in binary, the word “Computer” would be represented as:
1000011 1101111 1101110 1110000 1110101 1110100 1100101 1110010
‘A’ is represented by the decimal number 65 (binary __, hex __)
‘A’ is represented by the decimal number 65 (binary 1000001, hex 41)
Note that there are 127 active characters i.e. show or do something, however code 000 means ?
Note that there are 127 active characters i.e. show or do something, however code 000 means NUL which means do or show nothing, thus making up the 128 combinations.
Since computer architecture is built around the byte (which has 8 bits) the 7-bit ASCII table is a little inconvenient.
So ASCII characters are padded out to 8 bits, with the first bit always set to 0. This makes __ __ a little easier.
- but the 8th bit is used for what?
Since computer architecture is built around the byte (which has 8 bits) the 7-bit ASCII table is a little inconvenient.
So ASCII characters are padded out to 8 bits, with the first bit always set to 0. This makes memory management a little easier.
- used as a parity bit to perform a parity check (a form of error checking).
Extended ASCII vs ASCII
4
+ difference with Unicode
- ASCII uses 7 bits of an byte to represent a character
- ASCII can represent 128 characters
- ASCII sets the most significant bit as a parity bit or as 0
- Extended ASCII uses the most significant bit and can allow for the representation of 256 characters
- ASCII is less demanding on memory use than Unicode
Limitation of ASCII
The 128 or 256 character limits of ASCII and Extended ASCII limits the number of character sets that can be held. Representing the character sets for several different language structures is not possible in ASCII, there are just not enough available characters.
UNicdoe
- why it was needed
- how many bits
- how many characters
- example of additional character
While suitable for representing English characters, 256 characters is far too small to hold every character in other languages, such as Chinese or Arabic. Unicode uses 16 bits, giving a range of over 65,000 characters. This makes it more suitable for those situations.
Unicode also allows us to represent additional characters that are more visual such as emojis and emoticons.
What does Unicode aim to include - what key thing is it
Unicode is a universal character set. It is aimed to include all the characters needed for any writing system or language.
Unicode vs ASCII
- characters
- space
- Unicode represents a wide range of characters including different languages, mathematical symbols and emojis
- Unicode can represent a greater range of characters than ASCII
- Unicode occupies more space and is more demanding on memory than ASCII
Purpose of ASCII over Unicode - spec
- data representation of different alphabets and of special symbols allowing far greater range of characters
Images used in what form and why
Computers work in binary. All data must be converted into binary in order for a computer to process it. Images are no exception.
What’s a pixel (2)
- short for Picture Element
- a single point in an image
What are bitmapped images made of?
+ colours in images cause of pixels?
made up of pixels, a small square of solid colour
In many images, the pixels are too small for the human eye to see, so the colours appear to merge together.
Digital bitmapped images are made up of __. Each (1) is represented by a __ __.
Digital bitmapped images are made up of pixels. Each pixel is represented by a binary number.
NOT in advanced info:
Is 0/1 what colours in simple black and white image
0 - black
1 - white
What is colour depth
The number of bits used to represent each pixel
The greater the colour depth —> (purpose)
Many images need to use colours. To add colour, more bits are required for each pixel. The number of bits determines the range of colours
- greater number of colours
How many colours if colour depth of 2
For example, using a colour depth of two, ie two bits per pixel, would allow four possible colours, such as:
00 - black
01 - dark grey
10 - light grey
11 - white
Each extra bit __ the range of colours that are available:
- one bit per pixel (0 or 1) - __ possible colours
- two bits per pixel (00 to 11) - __ possible colours
- three bits per pixel (000 to 111) - __ possible colours
- four bits per pixel (0000 to 1111) - __ possible colours
- 16 bits per pixel (0000 0000 0000 0000 to 1111 1111 1111 1111) - over __ possible colours
Each extra bit doubles the range of colours that are available:
- one bit per pixel (0 or 1) - two possible colours
- two bits per pixel (00 to 11) - four possible colours
- three bits per pixel (000 to 111) - eight possible colours
- four bits per pixel (0000 to 1111) - 16 possible colours
- 16 bits per pixel (0000 0000 0000 0000 to 1111 1111 1111 1111) - over 65,000 possible colours
How more colours affects image file size (3 mark)
The more colours an image requires, the more bits per pixel are needed. Therefore, the more the colour depth, the larger the image file will be.
How is the size of an image expressed
- expressed directly as the width of image on pixels by height of image in pixels
- using the notation width x height
Tell me about image resolution (is this on our spec?)
- what does it effect
- what it means
- 2 units its expressed as
- difference of low resolution vs high, in terms of the pixels
- and link to file size
Image quality is affected by the resolution of the image.
Image resolution is the number of pixels in a specific area of an image. It is expressed as dots per inch (dpi), or pixels per inch (ppi), eg:
72dpi = 72 dots per inch
200 ppi = 200 pixels per inch
In a low-resolution image, the pixels are larger and therefore, fewer are needed to fill the space. This results in images that look blocky or pixelated. An image with a high resolution has more pixels, so it looks a lot better when it is enlarged or stretched. The higher the resolution of an image, the larger its file size will be.
Bitmap file size is based on (2)
Number of pixels and colour depth
Bitmap file size (bits) =
Image width x image height x colour depth in bits
Bitmap file size (bytes) =
(Image width x image height x colour depth in bits)/8
Metadata meaning
+ 3 examples (in terms of a file)
Data about data
Files contain extra data called metadata. Metadata includes data about the file itself, such as:
- file type
- date created
- author
An image file also includes metadata about the image data itself, such as: (3)
- the height and width of the image - this defines how many rows and columns the pixels are to be arranged in
- the resolution
- the colour depth
Without metadata - consequences on image data …
Without this metadata, the image data would not be correctly interpreted, meaning the image could not be correctly displayed.
How sound is converted to binary (from what also)
2
analogue sound is captured - usually by a microphone - and then converted into a digital signal
An analogue-to-digital converter will capture a sound wave at regular time intervals by measuring the height - amplitude - of the sound wave. This measurement is known as a sample.
Why (2) and what must sound be converted SPEC
Sound is analogue and must be converted to a digital form for storage and processing in a computer
SAMPLE meaning - spec
- measure of amplitude at a point in time
In one sentece, how does sound go from analogue to digital
- analogue signals are sampled to create the digital version of sounds
(Do we need to know)
- how sampling actually works
- sound recorded at each sample point is converted to its nearest numeric equivalent (in binary)
- the data is then stored in a file for later use
E.g. sample 1: has an amplitude of 8 in decimal = 1000 in binary
Define sample rate
+ how’s it measured
- the number of samples taken in a second
- usually measure din hertz (1 hertz = 1 sample per second)
The higher the sample rate, ? (2)
The higher the sample rate, the closer the recorded signal is to the original.
However, the higher the sample rate, the larger the resulting file. As a result, sound files are often a compromise between quality and size of file.
Sample resolution - define
The number of bits per sample
Calculate sound file sizes based on sampling rate and sample resolution
- formula
File size (bits) = sampling rate x sample resolution x number of seconds
Bit depth:
- what is it
- high bit depth = (2)
- typical bit depths
Bit depth refers to the number of bits used to record each sample. For images, the higher the bit depth, the more accurately a sound can be recorded, but the larger the file size. Typical bit depths are 16 bit and 24 bit.
Bit rate
- what
- formula
- higher bit rate
Bit rate is simply a measure of how much data is processed for each second of sound. Bit rate is calculated by:
Sample rate × bit depth
As with sample rate, the higher the bit rate, the better quality of the recorded sound.
So bit depth vs bit rate
Bit depth refers to the number of bits used to record each sample.
Bit rate is a measure of how much data is processed for each second of sound.
What is compression
+why
A method of reducing file sizes, particularly in digital media such as photos, audio and video.
Modern computers often generate files of very large sizes. For example, audio files often run to megabytes, while high definition video can be gigabytes in size. Such files require lots of storage space, and, because of their size, are difficult to transmit. These problems can be overcome by using compression.
There are two types of compression that can be applied to files:
There are two types of compression that can be applied to files:
lossy compression
lossless compression
What is lossy compression
With lossy compression, some data is removed and discarded, thereby reducing the overall amount of data and the size of the file.
Lossy compression in images
An image can be compressed by reducing its colour depth. This reduces the range of colours that the image contains. In practice, this results in an averaging of shades of colours. For example, a very light shade of green could be averaged with a not so light shade - the very light shade might be discarded, and the pixels affected by it re-coloured with the darker shade. If done carefully, this is not likely to significantly damage the quality of the image.
Lossy compression in sound (2)
For sound, lossy compression may remove sounds outside the human range of hearing that were nevertheless picked up during recording. This would produce no noticeable loss of quality, but would reduce the file size.
Similarly, an audio file can be compressed by reducing the bit depth of the samples. MP3 is a lossy audio file format.
3 lossy standards
- the JPEG file format works on this principle, which is why JPEG files tend to be smaller in size
- the MPEG file format compresses audio and video, making it more suitable for streaming media
- MP3 is a lossy format for audio, including music
Lossless compression
- what
- file size reduction
With lossless compression, files are reduced in size without the loss of data. However, lossless compression does not usually achieve the same file size reduction as lossy compression.
When would we want lossless compression
There are some files that we would not want to lose data from. For example:
- text files
- spreadsheets
- financial records
- emails
Various lossless standards exist: (2)
- PDF allows lossless compression of text documents
- PNG is a lossless image file format
How run length encoding works
One method of lossless compression is run length encoding (RLE). RLE looks at the data in a file for consecutive runs of the same data. These runs are stored as one item of data, instead of many.
Consider this row in a bitmap image:
Do RLE on
00 00 00 11 11 11 11 00 00 00
+ affect of RLE
The data for this is 00 00 00 11 11 11 11 00 00 00, which is ten data values of two characters each, giving 20 characters in total. RLE looks for the runs of each data, and records what the data is and how many times in succession it occurs. These values are stored instead of the original data.
For example:
00000011111111000000 becomes:
60 81 60 (six 0s, eight 1s, six 6s)
In large files, this can result in significant space savings.
What kind of compression if Huffman coding?
Lossless
How Huffman coding works
Huffman coding is a form of lossless compression which makes files smaller using the frequency with which characters appear in a message. This works particularly well when characters appear multiple times in a string as these can then be represented using fewer bits. This reduces the overall size of a file.
8 steps of Huffman coding
- Calculate how many times each character appears in the string.
- Put these in order of least to most frequent.
- Place the two least common characters along with their frequency in a binary tree. This is done by combining these in a new node and adding the individual frequencies of each character together.
- Update the table showing the combined characters.
- Take the next two frequent characters and repeat steps 3 and 4 using single letters first until all characters are combined.
- Next, follow each branch until the bottom is reached, recording a 0 for branches on the left and a 1 for branches on the right.
- This creates a unique code for each character which can be identified by following various paths down the tree.
- A set of optimal and completely unique bit patterns will have been created by following the tree until each individual character is reached.
Why is Huffman coding efficient
This particular technique is efficient because the letters that appear most frequently are assigned the shortest bit patterns. This makes the memory used for the compressed file optimal while preventing any confusion between the binary patterns.
Total bits per character worked out by
NOT IN ADVCACND INFO
Number of bits to store each character - so 10 is 2 bits
Multiplied by times used - so could be used 3 times
If B has a bit pattern 10 and is used 3 times - total bits is 6