Presentation is loading. Please wait.

Presentation is loading. Please wait.

©Brooks/Cole, 2003 Chapter 2 Data Representation.

Similar presentations


Presentation on theme: "©Brooks/Cole, 2003 Chapter 2 Data Representation."— Presentation transcript:

1 ©Brooks/Cole, 2003 Chapter 2 Data Representation

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

3 ©Brooks/Cole, 2003 DATA TYPES 2.1

4 ©Brooks/Cole, 2003 Figure 2-1 Different types of data

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

6 ©Brooks/Cole, 2003 DATA INSIDE THE COMPUTER DATA INSIDE THE COMPUTER 2.2

7 ©Brooks/Cole, 2003 A bit is the smallest unit of data that can be stored in a computer. It is either 0 or 1. Bit pattern: Byte: a bit pattern of length 8 Figure 2-2 Bit, Bit pattern, and Byte

8 ©Brooks/Cole, 2003 Figure 2-3 Examples of bit patterns

9 ©Brooks/Cole, 2003 REPRESENTINGDATAREPRESENTINGDATA 2.3

10 Data type representation Text Codes Numbers Images Bitmap Graphic Vector Graphic Audio Video

11 ©Brooks/Cole, 2003 Figure 2-4 Representing symbols using bit patterns Text: example

12 ©Brooks/Cole, 2003 Table 2.1 Number of symbols and bit pattern length Number of Symbols Number of Symbols --------------------- 2 4 8 16 … 128 256 … 65,536 Bit Pattern Length Bit Pattern Length --------------------- 1 2 3 4 … 7 8 … 16

13 ©Brooks/Cole, 2003 ASCII: American Standard Code for Information Interchange (Appendix A) Some features of ASCII code (P. 18) Figure 2-5 Representation of the word “BYTE” in ASCII code

14 ©Brooks/Cole, 2003 Images: bitmap graphic and vector graphics Figure 2-6 Image representation methods

15 ©Brooks/Cole, 2003 Figure 2-7 Bitmap graphic method of a black-and-white image

16 ©Brooks/Cole, 2003 Figure 2-8 Representation of color pixels

17 ©Brooks/Cole, 2003 Vector Graphics The problem of the bitmap graphic method: Difficult to rescale the image Vector graphic method: An image is decomposed into a combination of curves and line. Each curve or line is represented by a mathematical formula.

18 ©Brooks/Cole, 2003 Figure 2-9 Audio representation

19 ©Brooks/Cole, 2003 Audio Sampling means measuring the value of the signal at equal intervals. Quantization means assigning a value to a sample (i.e. 29.2 to 29). Coding means changing the quantized values to binary patterns.

20 ©Brooks/Cole, 2003 Video Video is a representation of images (frames) in time. Example: a movie Method: MPEG

21 ©Brooks/Cole, 2003 HEXADECIMALNOTATIONHEXADECIMALNOTATION 2.4

22 A 4-bit pattern can be represented by a hexadecimal digit, and vice versa. Note:

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

24 ©Brooks/Cole, 2003 Figure 2-10 Binary to hexadecimal and hexadecimal to binary transformation

25 ©Brooks/Cole, 2003 Example 1 Show the hexadecimal equivalent of the bit pattern 1100 1110 0010. Solution Each group of 4 bits is translated to one hexadecimal digit. The equivalent is xCE2.

26 ©Brooks/Cole, 2003 Example 2 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 000011100010, which is translated to x0E2.

27 ©Brooks/Cole, 2003 Example 3 What is the bit pattern for x24C? Solution Write each hexadecimal digit as its equivalent bit pattern to get 001001001100.

28 ©Brooks/Cole, 2003 OCTALNOTATIONOCTALNOTATION 2.5

29 A 3-bit pattern can be represented by an octal digit, and vice versa. Note:

30 ©Brooks/Cole, 2003 Table 2.3 Octal digits Bit Pattern Bit Pattern ------------ 000 001 010 011 Oct Digit Oct Digit ------------ 0 1 2 3 Bit Pattern Bit Pattern ------------ 100 101 110 111 Oct Digit Oct Digit ------------ 4 5 6 7

31 ©Brooks/Cole, 2003 Figure 2-11 Binary to octal and octal to binary transformation

32 ©Brooks/Cole, 2003 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 562 8.

33 ©Brooks/Cole, 2003 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 001100010, which is translated to 142 8.

34 ©Brooks/Cole, 2003 Example 6 What is the bit pattern for 24 8 ? Solution Write each octal digit as its equivalent bit pattern to get 010100.

35 ©Brooks/Cole, 2003 Key Terms ASCII Analog Binary digit Binary system Bit Bitmap graphic Bit pattern Byte Code Digital Hexadecimal notation Image Octal notation Picture element Pixel Quantization Sampling Switch Text Vector graphic Video


Download ppt "©Brooks/Cole, 2003 Chapter 2 Data Representation."

Similar presentations


Ads by Google