Basic Computing/ Computer        Orientation      Lecture 5,6 & 7     by Sara Hassan
Announcements   Office Room No. 22 (LBS faculty offices)   Lab on Monday. Venue: CS Dept basement lab.   Prelab & MS Wo...
Chapter 5     Data Representation
Data   Data can be of different kinds    Numeric             0, 1, 2, ……, 9    Alphabetic          A, B, C, ……, Z    Alph...
Number System   Computers normally use four number systems     Number System      Base     Decimal             10     Bin...
Conversion of Decimal Number Decimal integer converted to any other base, using division  operation To convert decimal i...
Decimal   Binary   Octal   Hexadecimal0         0000     000     01         0001     001     12         0010     002     2...
Convert Base 10 to Base 2, 8, 16             Chapter-5: Data Representation   8
Conversion of Decimal Fraction Fractional number less than 1. E.g. .5, .00453, .564. To convert decimal fraction     Bin...
Example: Conversion of DecimalFraction              0.865                     0.865                               0.865   ...
Conversion of DecimalInteger.Fraction Integer.fraction has both integer part and fraction part Steps for conversion   – ...
Convert 34.4674 from Base 10 toBase 2           Chapter-5: Data Representation   12
Conversion to Decimal Binary, octal, hexadecimal number has two parts   – integer part and fraction part Conversion meth...
Example: Conversion to Decimal1011.1001 fromBase 2 toBase 10     24.36 fromBase 8         toBase 10   4D.21 fromBase 16   ...
Conversion of Binary to Octal &Hexadecimal   Uses shortcut method.     – Octal - combination of 3 bits (23 = 8).     – He...
Example: Conversion of Binaryto Octal Given binary number         1110101100110 Partition binary number in groups of 3 b...
Conversion from Octal,Hexadecimal to Binary Uses inverse of steps for conversion of binary to octal and  hexadecimal Oct...
Example: Conversion fromHexadecimal to Binary Given number is 2BA3 Convert each hexadecimal digit into 4 digit binary nu...
Logic Gates   Manipulates binary information   Hardware electronic circuits which operate on input signals to    produce...
Logic Gates              Chapter-5: Data Representation   20
Logic Gates                                               Can you write                                                 th...
Thank YouChapter-5: Data Representation   22
Upcoming SlideShare
Loading in...5
×

Computer Chapter 5, 6 & 7

1,063

Published on

Lahore Business School (LBS)

Published in: Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,063
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Computer Chapter 5, 6 & 7

  1. 1. Basic Computing/ Computer Orientation Lecture 5,6 & 7 by Sara Hassan
  2. 2. Announcements Office Room No. 22 (LBS faculty offices) Lab on Monday. Venue: CS Dept basement lab. Prelab & MS Word Handout
  3. 3. Chapter 5 Data Representation
  4. 4. Data Data can be of different kinds Numeric 0, 1, 2, ……, 9 Alphabetic A, B, C, ……, Z Alphanumeric Combination of Numeric and Alphabetic Special Character +, -, $, #, Blank, ….. All data is represented using 0’s and 1’s in computer Each symbol is represented as a unique combination of 0’s and 1’s , e.g. 10011011 Chapter-5: Data Representation 4
  5. 5. Number System Computers normally use four number systems Number System Base Decimal 10 Binary 2 Octal 8 Hexadecimal 16 Chapter-5: Data Representation 5
  6. 6. Conversion of Decimal Number Decimal integer converted to any other base, using division operation To convert decimal integer to Binary: divide by 2 Octal: divide by 8 Hexadecimal: divide by 16 Chapter-5: Data Representation 6
  7. 7. Decimal Binary Octal Hexadecimal0 0000 000 01 0001 001 12 0010 002 23 0011 003 34 0100 004 45 0101 005 56 0110 006 67 0111 007 78 1000 010 89 1001 011 910 1010 012 A11 1011 013 B12 1100 014 C13 1101 015 D14 1110 016 E15 1111 017 F
  8. 8. Convert Base 10 to Base 2, 8, 16 Chapter-5: Data Representation 8
  9. 9. Conversion of Decimal Fraction Fractional number less than 1. E.g. .5, .00453, .564. To convert decimal fraction Binary: multiply by 2 Octal: multiply by 8 Hexadecimal: multiply by 16 Steps for conversion – Resulting number = fractional number * toBase – Record non-fractional part of resulting number – Repeat above steps at least four times – Write digits in non-fractional part starting from upwards to downwards Chapter-5: Data Representation 9
  10. 10. Example: Conversion of DecimalFraction 0.865 0.865 0.865 x2 x8 x 16 1.730 6.920 5190 x2 x8 865x 1.460 7.360 13.840 x2 x8 x 16 0.920 2.880 5040 x2 x8 840x 1.840 7.040 13.440 x2 The octal equivalent of (0.865)10 x 16 1.680 is (.6727)8 2640 x2 440x 1.360 7.040The binary equivalent of The number 13 in hexadecimal(.865)10 is (.110111)2 is D. The hexadecimal equivalent of (0.865)10 is (.DD7)16 Chapter-5: Data Representation 10
  11. 11. Conversion of DecimalInteger.Fraction Integer.fraction has both integer part and fraction part Steps for conversion – Convert decimal integer part to desired base – Convert decimal fraction part to desired base – Combine integer & fraction part to get integer.fraction Chapter-5: Data Representation 11
  12. 12. Convert 34.4674 from Base 10 toBase 2 Chapter-5: Data Representation 12
  13. 13. Conversion to Decimal Binary, octal, hexadecimal number has two parts – integer part and fraction part Conversion method of integer part and fraction part of binary, octal, hexadecimal number to decimal number uses multiplication operation Steps of conversion – Find sum of face value * (fromBase)position for each digit  Non-fractional number - rightmost digit position 0. Position increases towards left  Fractional number - first digit to left of decimal point has position 0. Position increases towards left. First digit to right of decimal point has position -1. Decreases towards right Chapter-5: Data Representation 13
  14. 14. Example: Conversion to Decimal1011.1001 fromBase 2 toBase 10 24.36 fromBase 8 toBase 10 4D.21 fromBase 16 toBase 101011.1001 24.36 4D.21 = 1*2 + 0*2 + 1*2 + 1*2 + 1*2 + = 2*81 + 4*80 + 3*8-1 + 6*8-2 3 2 1 0 -1 = 4*161 + D*160 + 2*16-1 + 1*16-20*2-2 + 0*2-3 + 1*2-4 = 16 + 4 + 3/8 + 6/64 = 64 + 13 + 2/16 + 1/256 = 8 + 0 + 2 + 1 + 1/2 + 0 + 0 + = 20 + 30/64 = 77 + 33/2561/16 = 20.4687 = 77.1289 = 11 + 9/16 = 11.5625 The decimal equivalent of The decimal equivalent of The decimal equivalent of (4D.21)16 (1011.1001)2 is 11.5625 (24.36)8 is 20.4687 is 77.1289 Chapter-5: Data Representation 14
  15. 15. Conversion of Binary to Octal &Hexadecimal Uses shortcut method. – Octal - combination of 3 bits (23 = 8). – Hexadecimal - combination of 4 bits (24=16) Steps for Binary to Octal conversion Partition binary number in groups of 3 bits, starting from right side For each group of three bits, find octal number Result: Combination of octal numbers Steps for Binary to Hexadecimal conversion Partition binary number in groups of 4 bits, starting from right side For each group of four bits, find hexadecimal number Result: Combination of hexadecimal numbers Chapter-5: Data Representation 15
  16. 16. Example: Conversion of Binaryto Octal Given binary number 1110101100110 Partition binary number in groups of 3 bits, starting from right side 1 110 101 100 110 For each group find its octal number Binary Number 1 110 101 100 110 Octal Number 1 6 5 4 6 Octal number is 16546 Chapter-5: Data Representation 16
  17. 17. Conversion from Octal,Hexadecimal to Binary Uses inverse of steps for conversion of binary to octal and hexadecimal Octal to Binary conversion Convert octal number into 3 digit binary number Result: Combination of all bits Hexadecimal to Binary conversion Convert hexadecimal number into 4 digit binary number Result: Combination of all bits Chapter-5: Data Representation 17
  18. 18. Example: Conversion fromHexadecimal to Binary Given number is 2BA3 Convert each hexadecimal digit into 4 digit binary number Hexadecimal 2 B A 3 Binary 0010 1011 1010 0011 Combine all bits to get result 0010101110100011 Chapter-5: Data Representation 18
  19. 19. Logic Gates Manipulates binary information Hardware electronic circuits which operate on input signals to produce output signals Unique symbol, operation using algebraic expression, truth table Basic - AND, OR, NOT Combination - NAND, NOR, XOR, XNOR Chapter-5: Data Representation 19
  20. 20. Logic Gates Chapter-5: Data Representation 20
  21. 21. Logic Gates Can you write the Truth Tables for each of the Gates? Chapter-5: Data Representation 21
  22. 22. Thank YouChapter-5: Data Representation 22

×