1 / 41

Chapter 2

Chapter 2. Data Representation. O BJECTIVES. Visualize how data are stored inside a computer. Understand the differences between text , numbers , images , video , and audio. Work with hexadecimal and octal notations. Define data types.

Download Presentation

Chapter 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 2 Data Representation

  2. OBJECTIVES Visualize how data are stored inside a computer. Understand the differences between text, numbers, images,video, and audio. Work with hexadecimal and octal notations. Define data types. After reading this chapter, the reader should be able to:

  3. 2.1 DATA TYPES

  4. Figure 2-1 Different types of data

  5. Note: The computer industry uses the term“multimedia” to define information that contains numbers, text, images, audio, and video.

  6. 2.2 DATA INSIDE THE COMPUTER

  7. Bit (Binary Digit)- is the smallest unit of data that can be stored in a computer; it is either 0 or 1. • Bit pattern - a string of bits Figure 2-2

  8. Computer memory does not know that type of data a stored bit pattern represents. • It just stores the data as bit patterns. • It is the responsibility of I/O devices or programs to interpret a bit pattern as a number, text, or some other type of data. Examples of bit patterns Figure 2-3

  9. Data are coded when they enter a computer and decodedwhen they are presented to the user.

  10. 2.3 REPRESENTING DATA

  11. TEXT • A piece of text in any language is a sequence of symbolsused to represent an idea in that language. • Symbols in English language : • Uppercase letters (A~Z) • Lowercase letters (a~z) • Numeric characters (0~9) • Punctuations (. , : ; …)

  12. Figure 2-4 Representing symbols using bit patterns

  13. Bit Pattern Length • How many bits are needed in a bit pattern to represent a symbol in a language? • It depends on how many symbols are in the set.

  14. Table 2.1 Number of symbols and bit pattern length Number of Symbols--------------------- 2 4 8 16 … 128 256 … 65,536 Bit Pattern Length--------------------- 1 2 3 4 … 7 8 … 16

  15. Codes • Code –Set of bit patterns designed to represent text symbols. • Coding –the process of representing symbols

  16. ASCII code – developed by ANSIuses 7 bits for each symbol. • This means 128 different symbols can be defined by this code. Representation of the word “BYTE” in ASCII code Figure 2-5

  17. Extended ASCII • To make the size of each pattern 1 byte (8 bits), the ASCII bit patterns are augmented with an extra 0 at the left. • Each pattern can easily fit into 1 byte of memory.

  18. EBCDIC & Unicode • EBCDIC- • Developed by IBM • Used in IBM mainframe computers. • Unicode – • 16 bits (65536 symbols) • Different sections of the code are allocated to symbols from different languages in the world.

  19. Figure 2-6 Image representation methods

  20. Bitmap Graphic • A image is divided into a matrix of pixels, where each pixel is a small dot. • More pixels  • Better representation of image  • Better resolution • More memory • Each pixel is assigned a bit pattern.The size and the value of the pattern depend on the image.

  21. Figure 2-7 Bitmap graphic method of a black-and-white image

  22. Color image • Each pixel is decomposed into 3 primary colors: red, green and blue. (RGB) • The intensity of each color is measured, and a bit pattern (8 bits) is assigned. Representation of color pixels Figure 2-8

  23. Resolution • The term is most often used to describe monitors, printers, and bit-mapped graphic images. • Dot-matrix and laser printers, the resolution indicates the number of dots per inch. For example, a 300-dpi (dots per inch) printer is one that is capable of printing 300 distinct dots in a line 1 inch long. This means it can print 90,000 dots per square inch. • Graphics monitors, the screen resolution signifies the number of dots (pixels) on the entire screen. For example, a 640-by-480 pixel screen is capable of displaying 640 distinct dots on each of 480 lines, or about 300,000 pixels.

  24. Vector Graphic • A image is decomposed into a combination of curves and lines. • Each curve or line is represented by a mathematical formula.

  25. Audio • Audio is a representation of sound or music. • Audio is by nature analog data. • It is continuous, not discrete. • Audio is converted to digital data and stored in bit patterns. • Sampling • Quantization • Coding • Stored

  26. Figure 2-9 Audio representation

  27. Video • Video is a representation of images (frames) in time. • A movie is a series of frames shown one after another to create the illusion of motion. • Today video is normally compressed.

  28. 2.4 HEXADECIMAL NOTATION

  29. Note: A 4-bit pattern can be representedby a hexadecimal digit,and vice versa.

  30. Table 2.2 Hexadecimal digits Bit Pattern------------ 0000 0001 0010 0011 0100 0101 0110 0111 Hex Digit------------ 0 1 2 3 4 5 6 7 Bit Pattern------------ 1000 1001 1010 1011 1100 1101 1110 1111 Hex Digit------------ 8 9 A B C D E F

  31. Figure 2-10 Binary to Hexadecimal and Hexadecimal to Binary transformation

  32. Example 1 Show the hexadecimal equivalent of the bit pattern 110011100010. Solution Each group of 4 bits is translated to one hexadecimal digit. The equivalent is xCE2.

  33. Example2 Show the hexadecimal equivalent of the bit pattern 0011100010. Solution Divide the bit pattern into 4-bit groups (from the right). In this case, add two extra 0s at the left to make the number of bits divisible by 4. So you have 0000 1110 0010, which is translated to x0E2.

  34. Example 3 What is the bit pattern for x24C? Solution Write each hexadecimal digit as its equivalent bit pattern to get0010 0100 1100.

  35. 2.5 OCTAL NOTATION

  36. Note: A 3-bit pattern can be representedby an octal digit, and vice versa.

  37. Table 2.3 Octal digits Oct Digit------------ 0 1 2 3 Oct Digit------------ 4 5 6 7 Bit Pattern------------ 000 001 010 011 Bit Pattern------------ 100 101 110 111

  38. Figure 2-11 Binary to Octal and Octal to Binary transformation

  39. Example 4 Show the octal equivalent of the bit pattern 101110010. Solution Each group of 3 bits is translated to one octal digit. The equivalent is 0562, o562, or 5628.

  40. Example 5 Show the octal equivalent of the bit pattern 1100010. Solution Divide the bit pattern into 3-bit groups(from the right). In this case, add two extra 0s at the left to make the number of bits divisible by 3. So you have 001 100 010, which is translated to 1428.

  41. Example 6 What is the bit pattern for 248? Solution Write each octal digit as its equivalent bit pattern to get 010100.

More Related