[1] Data Representation
-
Upload
mr-mcalpine -
Category
Education
-
view
27.129 -
download
3
description
Transcript of [1] Data Representation
![Page 1: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/1.jpg)
Data RepresentationRepresent!
How information is stored in a Computer
SystemWith our resident
Binary enthusiast …Brian
![Page 2: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/2.jpg)
• A computer is a two state machine (using only 1’s and 0’s to represent digits ‘on’ and ‘off’
• Represented using voltage (1 – 5 volts is ON! 0 volts … surprise OFF!)
• Binary System 1’s and 0’s• To + - * / fewer rules need to be built into
processor• Drop in voltage - NO EFFECT• Easy to represent two stages in storage
devices (presence of pits on a CD-ROM)
![Page 3: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/3.jpg)
• Use 1’s and 0’s to represent decimal numbers
• A BIT (1 OR 0) is the smallest unit of memory in a computer• 1 bit – 1 or 0 (two different numbers)• 2 bits – 00, 01, 10, 11 (four numbers)• 3 bits – 000, 001, 010, 011, 100, 101, 110, 111 – (8 different numbers)
![Page 4: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/4.jpg)
Are you getting it yet?
• How many different numbers can you represent with?– 4 bits?– 5 bits?– 6 bits?– 8 bits?
• Can easily work it out by …• Number of bits ^ 2
![Page 5: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/5.jpg)
• Taking an example using 8 bits• 256 individual combinations we can make
• 128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0• Lowest number we can represent
1 1 1 1 1 1 1 1
• Highest number we can represent
• We simply add up the numbers with a 1• 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1
![Page 6: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/6.jpg)
• We want to represent the number 83 in binary• (there’s a couple of ways of working it out)• 128 64 32 16 8 4 2 1 0 (coz 128 don’t fit!) 1 (64 fits, leaves 19)
0 1 (leaves 3) 0 0 Gives us 1 (1 left) 10 1 0 1 0 0 1 1
![Page 7: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/7.jpg)
Ok idiots, give this a go
Convert these from binary to decimal
• 0110 0111• 1110 0011• 0101 0110• 1010 1100
Convert these decimals to binary
• 255• 84• 172• 4
• 128 64 32 16 8 4 2 1
![Page 8: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/8.jpg)
Challenge – 12 bits
Convert these from binary to decimal
• 1001 0110 0111• 0101 1110 0011• 1011 0101 0110• 1101 1010 1100
• 128 64 32 16 8 4 2 1
![Page 9: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/9.jpg)
Right, so that’s easy
Not great, it doesn’t let us represent• Negative Numbers• Fractions of numbers
• Two’s Compliment• Floating Point Representation
![Page 10: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/10.jpg)
Two’s Compliment
Allows us to represent negative numbers• Need a way of recognising if a number is
negative• Two’s Compliment does thus• Take positive binary number 0000 1010 +10• Invert all bits 1111 0101 • ADD 1 ( 1 + 1 = 0, carry over) 1111 0110 -
10• Anyone work out how you know if it’s a
negative number?
![Page 11: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/11.jpg)
Remember!
To check which number representation we are using! If a question doesn’t tell you choose one yourself and write it down!
Convert to two’s compliment representation
• -9• -45• -187• -283
![Page 12: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/12.jpg)
The good thing!
When we are trying to check what a number is in decimal we just repeat the process! (that’s why two’s compliment is so good)
What are these numbers in decimal?• 1000 1101• 1111 0110• 1010 1010• 1100 0011
![Page 13: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/13.jpg)
More good bits
We used to use a signed bit to represent a negative number
• This reduce the number of bits available to represent the number
• This would have reduced the range of numbers which could be represented
• Computer Arithmetic was “Pure Mental”
![Page 14: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/14.jpg)
• 23.75 = 0.2375 * 10 ^ 2• 2375 – the mantissa• 2 – the exponent• The same thing in binary• Mantissa gives the number to be
represented• The exponent gives how many places to
“float” the decimal point
![Page 15: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/15.jpg)
Real Numbers
Number 13.758 4 2 1 0.5 0.25 0.125 0.0625 1 1 0 1 1 1 0 0Mantissa = 1101.1100Exponent (need to move 4 decimal places)8 4 2 10 1 0 0 Exponent = 0 1 0 01101 1100 0100 (all we need)
![Page 16: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/16.jpg)
Increasing the M and the E
Increasing the mantissaGiving more bits to represent a number
would increase the precision
Think of a tape measure(if there are more wee bits marking the
distances you will get a more precise measurement)
![Page 17: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/17.jpg)
Increasing the M and the E
Increasing the exponentThis means that the range of the
numbers is increased
10 * small exponent = small number10 * big exponent (more bits) = bigger
number Worksheet 1
![Page 18: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/18.jpg)
Questions and Reading
From the Walsh Book Read
Pages – 2 to 9
Questions (on page 20)1 2 3 4 5 6 7 8 9
Worksheet 1
![Page 19: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/19.jpg)
Data RepresentationHow text is
represented/sent in a computer system
ASCII CodeUNICODE
Memory Sizes
![Page 20: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/20.jpg)
• A byte is space which is used to store a character ( 8 bits )
• All the characters which can be represented are known as the character set
• Each character to display is given a different code
• ASCII is the most popular form• American Standard Code for Information
Interchange
![Page 21: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/21.jpg)
What does it all mean?•What’s in a bit?
•A 1 or a 0How should you remember
it?•Kinder Bueno
•8 wee bits or one big Byte!
![Page 22: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/22.jpg)
Memory Sizes
• Reminder
•Big•Boys•Kicked•My•Granny•Twice
![Page 23: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/23.jpg)
Memory Sizes
•Bit <- smallest•Byte•Kilobyte•Megabyte•Gigabyte•Terabyte <- biggest
![Page 24: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/24.jpg)
• A bit is the smallest unit of memory• There are 8 bits in a byte• There are 1024 bytes in a kilobyte• There are 1024 Kb in a Megabyte• There are 1024 Mb in a Gigabyte• There are 1024 Gb in a Terabyte
![Page 25: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/25.jpg)
Calculating Memory Sizes
We don’t say our broadband speed is33 million bits per second4 Megabytes
We don’t say our computer has687194767360 bits of
memory80 Gigabytes
Calculating the correct sizes is a wee bit fidgety but you get used to it
![Page 26: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/26.jpg)
Calculating Memory Sizes
bits / 8bytes / 1024kilobytes / 1024megabytes /
1024gigabytes / 1024terabytes
TAKE A NOTE
Terabytes * 1024Gigabytes * 1024Megabytes *
1024Kilobytes * 1024Bytes * 8bits
TAKE A NOTEWorksheet 3
![Page 27: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/27.jpg)
ASCII Code
ASCII is a 7 bit code which allows 128 characters
Extended ASCII allows 8 bits or 256 characters
Used to represent text although some characters don’t print
0 – 31 are what is known as control characters
Carriage Return, Tab, Clear Screen for example
![Page 28: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/28.jpg)
UNICODE
What about the CODES that ASCII cannot represent? The Japanese for example
UNICODE is a 16 bit code which is used to represent a lot more characters
ASCII uses less memory (7 bits)UNICODE capable of representing a lot
more characters
![Page 29: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/29.jpg)
ASCII Code
65 in decimal = A66 = B67 = C and so on and so forth
We can code messages and understand what they say etc
I intercepted a nasty text from Mr Arthur to Mr McGowan help me out a bit
Have a bash at working out this messageWorksheet 2
![Page 30: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/30.jpg)
Data RepresentationGraphics
How are Graphics stored in a Computer
SystemCalculating memory
requirements
![Page 31: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/31.jpg)
• Graphics are made up of tiny dots called PIXELS each requiring one bit
• Picture Elements 49 bits memory. WHY?
![Page 32: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/32.jpg)
Resolution
A screen display of 800 x 600 is smaller is resolution
1024 x 768 is higher resolutionTwo types of Graphic
Bit mapped Vector
![Page 33: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/33.jpg)
Resolution
A screen display of 800 x 600 is smaller is resolution
1024 x 768 is higher resolutionTwo types of Graphic
Bit mapped VectorThese store the graphics in different
ways
![Page 34: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/34.jpg)
Bit Mapped
Think about PaintWhen you draw a shape on top of
another it rubs out anything on the bottom
It has a fixed resolution (which means your image is rubbish when printed!)
You can zoom in and edit individual pixels
It saves the full screen – even if there’s nothing on there!
![Page 35: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/35.jpg)
Vector Graphics
Keeps shapes as separate objects Saves attributes of objects rather than all
pixels – less memory requirementsResolution Independence – prints at the
full resolution available on printerCan edit all the individual objects which
make up the graphic, but not the individual pixels
![Page 36: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/36.jpg)
Backing Storage Requirements
This image of screech measures 2 inches by 2 inches.
It has a resolution of 80 dpi using 256 colours
Memory Required
Total Pixels
(2 * 80) * (2 * 80) = 25, 600
Each pixel could be one of 256 different colours
256 requires 8 bits
25,600 * 8 = 204, 800 bits
204, 800 = 25,600 bytes or 25 kilobytes
![Page 37: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/37.jpg)
Your Turn
This idiots picture measures 3 inches by 2 inches
It has a resolution of 150 dots per inch.
It uses TRUE COLOUR which uses 24 bits per pixel
Worksheet 4
![Page 38: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/38.jpg)
Data RepresentationThe need for Compression
Different methods of Compression
![Page 39: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/39.jpg)
Data Compression
Compression simply means reducing the size of a file in order to save some space
Two different types
Lossy
Lossless
![Page 40: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/40.jpg)
Lossless Compression
Means that none of the original data is lost
Counting repeating pixels is one method
This means you can save– Store what colour pixel is– How many are repeated in a row– Saves a lot of memory
![Page 41: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/41.jpg)
Lossy Compression
Means you sacrifice some data to reduce the file size
• Using complex mathematical coding• Ditching stuff our eyes cant see• Can reduce size more than lossless• But, only if it doesn’t make the file
useless
Worksheet 5
![Page 42: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/42.jpg)
Advantages of Compression
Bit maps use up a lot of backing storage
- Compression saves a lot of it
- The less space it takes up the less time it takes to transfer it in an email etc
- Takes less time to load up in a web browser
![Page 43: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/43.jpg)
Disadvantages of Compression
If Lossy compression is used then detail may be lost from the images
Can alter the images introducing things that weren’t there
Take a lot of time to compress a very large image
Repeated compression can alter and affect the image
![Page 44: [1] Data Representation](https://reader033.fdocuments.in/reader033/viewer/2022061300/54d30ff24a7959c6348b4589/html5/thumbnails/44.jpg)
And here it ends
That’s everything in Section 1: Data Representation
What you need to do now:Read Scholar for more in depth
informationRead Walsh for the samePractice loads of questions (Walsh Book)Study for end of section test