©brooks/cole, 2003 chapter 2 data representation

25
©Brooks/Cole, 2003 Chapter 2 Data Representation

Post on 21-Dec-2015

255 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Chapter 2

DataRepresentation

Page 2: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Define data types.Define data types.

Visualize how data are stored inside a computer.Visualize how data are stored inside a computer.

Understand the differences between text, numbers, images,Understand the differences between text, numbers, images,video, and audio.video, and audio.

After reading this chapter, the reader should After reading this chapter, the reader should be able to:be able to:

OOBJECTIVESBJECTIVES

Work with hexadecimal and octal notations.Work with hexadecimal and octal notations.

Page 3: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

DATA TYPESDATA TYPESDATA TYPESDATA TYPES

2.12.1

Page 4: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Figure 2-1Different types of data

Page 5: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

The computer industry uses the termThe computer industry uses the term“multimedia” to define information “multimedia” to define information that contains numbers, text, images, that contains numbers, text, images,

audio, and video.audio, and video.

Note:Note:

Page 6: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

DATA INSIDEDATA INSIDETHE COMPUTERTHE COMPUTER

DATA INSIDEDATA INSIDETHE COMPUTERTHE COMPUTER

2.22.2

Page 7: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Figure 2-2Bit pattern

Page 8: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Figure 2-3Examples of bit patterns

Page 9: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

REPRESENTINGREPRESENTINGDATADATA

REPRESENTINGREPRESENTINGDATADATA

2.32.3

Page 10: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Figure 2-4

Representing symbols using bit patterns

Page 11: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Table 2.1 Number of symbols and bit pattern lengthTable 2.1 Number of symbols and bit pattern length

Number of SymbolsNumber of Symbols---------------------

248

16…

128256…

65,536

Bit Pattern LengthBit Pattern Length---------------------

1234…

78…

16

Page 12: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

ASCII-I Punctuations, Letters, Digits

Page 13: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

ASCII-II Non-English and Special

Page 14: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Figure 2-5

Representation of the word “BYTE” in ASCII code

Page 15: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Figure 2-6

Image representation methods

Page 16: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Figure 2-7Bitmap graphic method of a

black-and-white image

Page 17: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Figure 2-8Representation of color pixels

Page 18: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Figure 2-9Audio representation

Page 19: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

HEXADECIMALHEXADECIMALNOTATIONNOTATION

HEXADECIMALHEXADECIMALNOTATIONNOTATION

2.42.4

Page 20: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

A 4-bit pattern can be representedA 4-bit pattern can be representedby a hexadecimal digit,by a hexadecimal digit,

and vice versa.and vice versa.

Note:Note:

Page 21: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Table 2.2 Hexadecimal digitsTable 2.2 Hexadecimal digits

Bit PatternBit Pattern------------

00000001001000110100010101100111

Hex DigitHex Digit------------

01234567

Bit PatternBit Pattern------------

10001001101010111100110111101111

Hex DigitHex Digit------------

89ABCDEF

Page 22: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Figure 2-10

Binary to hexadecimal and hexadecimal to binary transformation

Page 23: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Example 1Example 1

Show the hexadecimal equivalent of the bit pattern 1100 1110 0010.

SolutionSolution

Each group of 4 bits is translated to Each group of 4 bits is translated to one hexadecimal digit. The equivalent one hexadecimal digit. The equivalent is xCE2.is xCE2.

Page 24: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Example 2Example 2

Show the hexadecimal equivalent of the bit pattern 0011100010.

SolutionSolution

Divide the bit pattern into 4-bit groups (from the Divide the bit pattern into 4-bit groups (from the right). In this case, add two extra 0s at the left to right). In this case, add two extra 0s at the left to make the number of bits divisible by 4. So you make the number of bits divisible by 4. So you have 000011100010, which is translated to have 000011100010, which is translated to x0E2x0E2..

Page 25: ©Brooks/Cole, 2003 Chapter 2 Data Representation

©Brooks/Cole, 2003

Example 3Example 3

What is the bit pattern for x24C?

SolutionSolution

Write each hexadecimal digit as its Write each hexadecimal digit as its equivalent bit pattern to getequivalent bit pattern to get001001001100.001001001100.