Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Computer Systems Data Representation

Computer Systems Data Representation

  1. 1. Higher Computing Mr Arthur
  2. 2. Course Outline <ul><li>3 Main Units </li></ul><ul><ul><li>Computer Systems = 40 hours </li></ul></ul><ul><ul><li>Software Development = 40 hours </li></ul></ul><ul><ul><li>Artificial Intelligence = 40 hours </li></ul></ul><ul><li>Assessment </li></ul><ul><ul><li>3 End of Unit Assessments (NABS) </li></ul></ul><ul><ul><li>Practical Coursework Tasks (/60 or 30%) </li></ul></ul><ul><ul><li>Written Exam (/140 or 70%) </li></ul></ul>
  3. 3. Computer Systems <ul><li>5 units in the Computer Systems Section </li></ul><ul><ul><li>Data Representation = 6 hours </li></ul></ul><ul><ul><li>Computer Structure = 7 hours </li></ul></ul><ul><ul><li>Peripherals = 5 hours </li></ul></ul><ul><ul><li>Networking = 9 hours </li></ul></ul><ul><ul><li>Computer Software = 9 hours </li></ul></ul>
  4. 4. Aims of Lesson 1 <ul><li>How are numbers, text and images represented inside the computer system? </li></ul><ul><li>Discussing the 2 state computer system </li></ul><ul><li>Converting positive whole numbers to binary and vice versa </li></ul><ul><li>Playing Binary Bingo </li></ul>
  5. 5. Data Representation 100 billion switches per sq. cm
  6. 6. Data Storage <ul><li>Numbers, Text, and Images are all stored as a series of 1s and 0s inside the computer system. </li></ul><ul><li>These series of 1s and 0s are made up of pulses of electricity from 1 volt to 5 volts </li></ul>
  7. 7. Decimal Counting System <ul><li>When we represent numbers we use the decimal counting system, for example </li></ul><ul><li>123,000 </li></ul><ul><li>100,000 10,000 1,000 100 10 1 </li></ul><ul><li>1 2 3 0 0 0 </li></ul><ul><li>Since the computer is 2 state, the binary counting system goes up by the power 2, rather than 10 i.e </li></ul><ul><li>256 128 64 32 16 8 4 2 1 </li></ul>
  8. 8. How Positive Whole Numbers are Stored <ul><li>34 </li></ul><ul><li>128 64 32 16 8 4 2 1 </li></ul><ul><li>0 0 1 0 0 0 1 0 </li></ul><ul><li>= 32 + 2 </li></ul><ul><li>134 </li></ul><ul><li>128 64 32 16 8 4 2 1 </li></ul><ul><li>1 0 0 0 0 1 1 0 </li></ul><ul><li>= 128 + 4 + 2 </li></ul>
  9. 9. Binary back to Decimal <ul><li>1011 0011 </li></ul><ul><li>128 64 32 16 8 4 2 1 </li></ul><ul><li>1 0 1 1 0 0 1 1 </li></ul><ul><li>= 128 + 32 + 16 + 2 + 1 </li></ul><ul><li>= 179 </li></ul>
  10. 10. Binary to Decimal <ul><li>What is the decimal representation of the following 8 bits using 2s complement </li></ul><ul><li>(a) 0001 0110 </li></ul><ul><li>(b) 1000 1100 </li></ul><ul><li>(c) 0111 0011 </li></ul><ul><li>What is the 8 bit representation of the following decimal numbers </li></ul><ul><li>(a) 174 </li></ul><ul><li>(b) 121 </li></ul><ul><li>(c) 71 </li></ul>
  11. 11. Binary Bingo <ul><li>42 </li></ul><ul><li>81 </li></ul><ul><li>21 </li></ul><ul><li>16 </li></ul><ul><li>121 </li></ul><ul><li>73 </li></ul><ul><li>101 </li></ul><ul><li>75 </li></ul><ul><li>127 </li></ul><ul><li>13 </li></ul><ul><li>209 </li></ul><ul><li>32 </li></ul><ul><li>56 </li></ul><ul><li>175 </li></ul><ul><li>192 </li></ul><ul><li>186 </li></ul><ul><li>176 </li></ul><ul><li>121 </li></ul>
  12. 12. Data Storage <ul><li>1 or 0 = 1 bit </li></ul><ul><li>8 bits = 1 byte </li></ul><ul><li>1024 bytes = 1 kilobyte </li></ul><ul><li>1024 kilobytes = 1 megabyte </li></ul><ul><li>1024 megabytes = 1 gigabyte </li></ul>
  13. 13. Aims of Lesson 2 <ul><li>Representation of negative whole numbers </li></ul><ul><li>The 2s complement system </li></ul>
  14. 14. Representing Negative Numbers <ul><li>The signed bit method </li></ul><ul><li>0000 0001 = 1 </li></ul><ul><li>0000 0000 = 0 </li></ul><ul><li>1000 0001 = -1 </li></ul><ul><li>1000 0010 = -2 </li></ul><ul><li>1000 0011 = -3 </li></ul><ul><li>1000 0100 = -4 </li></ul>
  15. 15. Representing Negative Numbers <ul><li>There is a problem with this method?? </li></ul><ul><li>Using 8 bits you can only store the decimal numbers from </li></ul><ul><li>128 64 32 16 8 4 2 1 </li></ul><ul><li>1 1 1 1 1 1 1 1 </li></ul><ul><li>= 64 +32+16+8+4+2+1 = -127 </li></ul><ul><li>128 64 32 16 8 4 2 1 </li></ul><ul><li>0 1 1 1 1 1 1 1 </li></ul><ul><li>=64+32+16+8+4+2+1=127 </li></ul><ul><li>Rather than -255 to 255 </li></ul>
  16. 16. 2s Complement <ul><li>What is the 8 bit two’s complement representation of the decimal number -101 </li></ul><ul><li>101 </li></ul><ul><li>128 64 32 16 8 4 2 1 </li></ul><ul><li>0 1 1 0 0 1 0 1 </li></ul><ul><li>Invert numbers </li></ul><ul><li>1 0 0 1 1 0 1 0 </li></ul><ul><li>+1 </li></ul><ul><li>-101 </li></ul><ul><li>1 0 0 1 1 0 1 1 </li></ul>
  17. 17. Negative Whole Numbers <ul><li>What is the decimal representation of the following 8 bits using 2s complement </li></ul><ul><li>1 0 1 0 1 1 1 1 </li></ul><ul><li>You invert every number </li></ul><ul><li>0 1 0 1 0 0 0 0 </li></ul><ul><li>Then add 1 </li></ul><ul><li>0 1 0 1 0 0 0 1 </li></ul><ul><li>128 64 32 16 8 4 2 1 </li></ul><ul><li>64+16+1 </li></ul><ul><li>-81 </li></ul>
  18. 18. 2s Complement Questions <ul><li>What is the decimal representation of the following 8 bits using 2s complement </li></ul><ul><li>(a) 1000 1011 </li></ul><ul><li>(b) 1100 1100 </li></ul><ul><li>(c) 1001 0111 </li></ul><ul><li>(d) 1110 1100 </li></ul><ul><li>What is the 8 bit two’s complement representation of the following decimal numbers </li></ul><ul><li>(a) -45 </li></ul><ul><li>(b) -121 </li></ul><ul><li>(c) -176 </li></ul><ul><li>(d) -71 </li></ul>
  19. 19. Aims of Lesson 3 <ul><li>So far we have looked at representing positive and negative whole numbers using binary </li></ul><ul><li>We are now going to look at the representation of non whole numbers using the floating point system </li></ul>
  20. 20. Representing Non Whole Numbers <ul><li>How do we represent the number 128.75 in binary? </li></ul><ul><li>128 + 0.5 + 0.25 </li></ul><ul><li>= 128.75 </li></ul>128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625 1 0 0 0 0 0 0 0 1 1 0 0
  21. 21. Mantissa and Exponent <ul><li>Mantissa </li></ul><ul><li>Exponent </li></ul><ul><li>8 </li></ul><ul><li>8 4 2 1 </li></ul><ul><li>1 0 0 0 </li></ul>128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0
  22. 22. <ul><li>Mantissa </li></ul><ul><li>Exponent </li></ul><ul><li>6 </li></ul><ul><li>8 4 2 1 </li></ul><ul><li>0 1 1 0 </li></ul>1 0 0 1 1 0 0 0 1 0 1 0 0 1 1 0 0 0 1 0 How do we represent the number 38.125 using floating point 32 16 8 4 2 1 0.5 0.25 0.125 0.0625
  23. 23. Representing Non Whole Numbers <ul><li>Mantissa relates to the precision of the number you can represent i.e 34.44454321 </li></ul><ul><li>Exponent relates to the range of the number </li></ul><ul><li>1111 = 15 </li></ul><ul><li>1111 1111 = 255 </li></ul>8 4 2 1 0.5 0.25 0.125 0.075 0.0375 0.01875 0.009375
  24. 24. <ul><li>What is the decimal number if the Mantissa is </li></ul><ul><li>10010011 and the exponent is 0101 </li></ul><ul><li>Exponent </li></ul><ul><li>8 4 2 1 </li></ul><ul><li>0 1 0 1 </li></ul><ul><li>= 5 </li></ul><ul><li>Mantissa </li></ul><ul><li>1 0 0 1 0 0 1 1 </li></ul>Mantissa and Exponent 16 8 4 2 1 0.5 0.25 0.125 16 + 2 + 0.25 + 0.125 = 18.375
  25. 25. Aims of Lesson 4 <ul><li>So far we have looked at representing positive and negative whole numbers using binary </li></ul><ul><li>We have also looked at representing non whole numbers using floating point. </li></ul><ul><li>Today we are going to practice converting storage capacities from bit, byte, kilobyte, megabyte, gigabyte, terabyte </li></ul><ul><li>Discuss how text is represented in a computer system </li></ul>
  26. 26. Storage Capacities 0 or 1 = 1 bit 8 bits = 1 byte 1024 bytes = 1 Kilobyte 1024 Kilobytes = 1 Megabyte 1024 Megabytes = 1 Gigabyte 1024 Gigabytes = 1 Terabyte
  27. 27. Storage Conversions <ul><li>I have a 2 Gigabyte IPOD Classic. How many 512Kb songs can I store on the IPOD? </li></ul><ul><li>Convert 2Gb to Kb </li></ul><ul><li>2 X 1024 = 2048Mb </li></ul><ul><li>2048 X 1024 = 2,097,152Kb </li></ul><ul><li>512Kb </li></ul><ul><li>4096 Songs </li></ul>
  28. 28. Storage Conversion Questions <ul><li>I have a memory card for a Digital Camera with a capacity of 4Gb. How many 460Kb images can I store on the memory card? </li></ul><ul><li>Mr Haggarty has recently been working as a DJ at weekends. He has bought an external hard disk to back up songs. How many 4Mb songs would he be able to fit on the 80Gb hard disk? </li></ul>
  29. 29. Solutions <ul><li>4Gb X 1024 = 4096Mb </li></ul><ul><li>4096 X 1024 = 4,194,304Kb </li></ul><ul><li> 460Kb </li></ul><ul><li>= 9118 images </li></ul><ul><li>80Gb X 1024 = 81920Mb </li></ul><ul><li>4Mb </li></ul><ul><li>= 20,480 songs </li></ul>
  30. 30. How is Text Represented <ul><li>ASCII </li></ul><ul><ul><li>Each key on the keyboard is converted into a binary code using 7 bits </li></ul></ul><ul><ul><li>Using 7 bits i.e 2 = 128 characters can be represented </li></ul></ul><ul><li>Character Set </li></ul><ul><ul><li>A list of all the characters which the computer can process </li></ul></ul><ul><li>Control Characters </li></ul><ul><ul><li>Codes 0 to 31 are non printable characters </li></ul></ul>7 97 110 0001 a 65 100 0001 A 49 011 0001 1 34 010 0010 ‘ 33 010 0001 ! 32 010 0000 space 13 000 1101 return 9 000 1001 tab Decimal Binary Character
  31. 31. How is Text Represented <ul><li>Unicode (Universal Code) </li></ul><ul><ul><li>Each key on the keyboard is converted into a binary code using 16 bits </li></ul></ul><ul><ul><li>Using 16 bits i.e 2 = 65,536 characters can be represented </li></ul></ul><ul><ul><li>Can represent Latin, Roman, Japanese characters </li></ul></ul><ul><li>Advantages </li></ul><ul><ul><li>More characters can be represented </li></ul></ul><ul><li>Disadvantages </li></ul><ul><ul><li>Takes up more than twice as much space for each character </li></ul></ul>16
  32. 32. Aims of Lesson 5 <ul><li>Last Lessons </li></ul><ul><li>Representing positive whole numbers as binary </li></ul><ul><li>Representing negative whole numbers using 2s complement </li></ul><ul><li>Non whole numbers using mantissa and exponent </li></ul><ul><li>Storage calculations </li></ul><ul><li>Looked at how text is represented using ASCII and Unicode </li></ul><ul><li>Today’s Lesson </li></ul><ul><li>Discuss graphic representation </li></ul><ul><li>Calculate storage capacities of colour Bit Map graphics </li></ul><ul><li>Bit Map v Vector </li></ul>
  33. 33. BIT Map Graphics SCREEN MEMORY PIXEL MEMORY REQUIRED 8 BITS X 8 BITS = 64 BITS = 8 BYTES Bit Map = the graphic is made up from a series of pixels
  34. 34. Graphics Resolution <ul><li>The smaller the size of the pixels, the finer the detail of the image </li></ul><ul><li>800 x 600 pixels lower quality than 1024 x 768 </li></ul><ul><li>As the number of pixels increases so does the storage space required </li></ul>Pixel Pattern using 8x8 grid Pixel Pattern using 16x16 grid
  35. 35. Calculating Storage Capacities of Bit Mapped Images <ul><li>Storage Requirements = total number of pixels * number of bits used for each pixel </li></ul><ul><li>This picture of Mr Haggarty has a resolution of 300dpi. The image is 2 inches by 4 inches in 128 colours </li></ul><ul><li>300 X 2 = width 600 pixels </li></ul><ul><li>300 X 4 = height 1200 pixels </li></ul><ul><li>Total pixels = 600 X 1200 = 720,000 pixels </li></ul><ul><li>Each pixel = 7 bits i.e. 2 = 128 colours </li></ul><ul><li>720,000 X 7 = 5,040,000 bits / 8 = 630,000 bytes </li></ul><ul><li>630,000 / 1024 = 615Kb </li></ul>7
  36. 36. Bit Map V Vector Graphics <ul><li>Bit Map Graphic </li></ul><ul><ul><li>Bit map packages paint pictures by changing the colour of the pixels </li></ul></ul><ul><ul><li>Known as “Paint Packages” </li></ul></ul><ul><ul><li>When shapes overlap, the one on top rubs out the other </li></ul></ul><ul><ul><li>When you save a file the whole screen is saved </li></ul></ul><ul><ul><li>The resolution of the image is fixed when you create the image </li></ul></ul><ul><li>Vector Graphic </li></ul><ul><ul><li>Work by drawing objects on the screen </li></ul></ul><ul><ul><li>Known as “Draw Packages” </li></ul></ul><ul><ul><li>When shapes overlap they remain as separate objects </li></ul></ul><ul><ul><li>Only the object attributes are stored taking up much less space </li></ul></ul><ul><ul><li>Resolution Independent </li></ul></ul>
  37. 37. Aims of Lesson 6 <ul><li>Last Lessons </li></ul><ul><li>Representing positive whole numbers as binary </li></ul><ul><li>Representing negative whole numbers using 2s complement </li></ul><ul><li>Non whole numbers using mantissa and exponent </li></ul><ul><li>Storage calculations </li></ul><ul><li>Looked at how text is represented using ASCII and Unicode </li></ul><ul><li>Discuss graphic representation </li></ul><ul><li>Calculate storage capacities of colour Bit Map graphics </li></ul><ul><li>Bit Map v Vector </li></ul><ul><li>Today’s Lesson </li></ul><ul><li>Discuss true colour </li></ul><ul><li>Today’s Tasks </li></ul><ul><li>Complete Data Representation Questions </li></ul><ul><li>Read chapter in the book </li></ul>
  38. 38. True Colour <ul><li>Bit Depth (Colour Depth) </li></ul><ul><ul><li>The number of bits used to represent colours in the graphic </li></ul></ul><ul><ul><ul><li>1 bit = black or white </li></ul></ul></ul><ul><ul><ul><li>2 bits = 4 colours </li></ul></ul></ul><ul><ul><ul><li>3 bits = 8 colours </li></ul></ul></ul><ul><ul><ul><li>8 bits = 256 colours </li></ul></ul></ul><ul><ul><ul><li>24 bits = 16,777,216 colours this is true colour </li></ul></ul></ul><ul><li>True Colour </li></ul><ul><ul><li>24 bits </li></ul></ul><ul><ul><ul><li>8 bits for red </li></ul></ul></ul><ul><ul><ul><li>8 bits for blue </li></ul></ul></ul><ul><ul><ul><li>8 bits for green </li></ul></ul></ul>Bit Depth = 1 bit Human eye cannot distinguish between adjacent shades of grey when looking at more than 200 shades between black and white Bit Depth = 2 bit
  39. 39. Bit Depths Bit Depth = 2 bits 01 10 11 00
  40. 40. Solutions <ul><li>Question 1 </li></ul><ul><li>2 inches X 90 = 180 pixels </li></ul><ul><li>2 inches X 90 = 180 pixels </li></ul><ul><li>180 X 180 = 32,400 pixels in total </li></ul><ul><li>256 colours = 2 power 8 </li></ul><ul><li>32,400 X 8 = 259,200 bits </li></ul><ul><li>259,200/8 = 32,400 bytes </li></ul><ul><li>32,400 / 1024 = 31.6Kb </li></ul><ul><li>Question 2 </li></ul><ul><li>5 inches X 200 = 1000 pixels </li></ul><ul><li>3 inches X 200 = 600 pixels </li></ul><ul><li>1000 X 600 = 600,000 pixels in total </li></ul><ul><li>128 colours = 2 power 7 </li></ul><ul><li>600,000 X 7 = 4,200,000 bits </li></ul><ul><li>4,200,000/8 = 525,000 bytes </li></ul><ul><li>525,000 / 1024 = 512.7Kb </li></ul>
  41. 41. Aims of Lesson 7 <ul><li>Last Lessons </li></ul><ul><li>Representing positive whole numbers as binary </li></ul><ul><li>Representing negative whole numbers using 2s complement </li></ul><ul><li>Non whole numbers using mantissa and exponent </li></ul><ul><li>Storage calculations </li></ul><ul><li>Looked at how text is represented using ASCII and Unicode </li></ul><ul><li>Discuss graphic representation </li></ul><ul><li>Calculate storage capacities of colour Bit Map graphics </li></ul><ul><li>Bit Map v Vector </li></ul><ul><li>True Colour </li></ul><ul><li>Today’s Lesson </li></ul><ul><li>Data Compression </li></ul><ul><li>Today’s Tasks </li></ul><ul><li>Complete Compression task </li></ul><ul><li>Issue Scholar logins </li></ul><ul><li>Complete Data Representation Questions Sheet </li></ul><ul><li>Read chapter in the book </li></ul>
  42. 42. Compression <ul><li>Data compression means reducing the size of a file in order to save backing storage space. </li></ul><ul><li>2 types of compression </li></ul><ul><ul><li>Lossless compression </li></ul></ul><ul><ul><li>Lossy compression </li></ul></ul>
  43. 43. Lossless Compression <ul><li>Lossless means that none of the original data is lost </li></ul><ul><li>One method of lossless compression involves counting repeating pixels </li></ul>COLOUR = 10011000 11100000 e.g. 16 bits NUMBER OF THE SAME PIXELS = 32 100000 STORAGE REQUIRED = 16 BITS + 6 BITS = 22 BITS
  44. 44. Lossy Compression <ul><li>Lossy compression involves sacrificing some of the data in order to reduce the file size </li></ul><ul><li>Deliberately losing some types of information that our eyes and brains usually ignore </li></ul><ul><li>Lossy is only suitable if the loss of data will not cause the file to become useless </li></ul><ul><li>JPEG is a file format that uses lossy compression to reduce file sizes </li></ul>
  45. 45. Data Representation – Learning Aims <ul><li>Representation of positive numbers in binary up to 32 bits </li></ul><ul><li>Conversion from binary to decimal and vice versa </li></ul><ul><li>Representation of negative numbers using 2s complement </li></ul><ul><li>Representation of non whole numbers using floating point with mantissa and exponent </li></ul><ul><li>Conversion to and from bit, byte, kilobyte, megabyte, gigabyte, terabyte </li></ul>
  46. 46. Data Representation – Learning Aims <ul><li>Unicode and its advantages over ASCII </li></ul><ul><li>Description of the bit map method of graphics representation </li></ul><ul><li>Description of the relationship between bit depth and the number of colours represented up to 24 bit depth </li></ul><ul><li>Vector graphics </li></ul><ul><li>Relationship between bit depth and file size </li></ul>

×