Data Representation
Data Representation
Data Representation
• Data Representation refers to the methods used
internally to represent information stored in a
computer. Computers store lots of different types
of information:
• numbers
• text
• graphics of many varieties (stills, video,
animation)
• sound
• Memory Structure in Computer
• Memory consists of bits (0 or 1)
– a single bit can represent two pieces of information
• bytes (=8 bits)
– a single byte can represent 256 = 2x2x2x2x2x2x2x2 = 28
pieces of information
• words (=2,4, or 8 bytes)
– a 2 byte word can represent 2562 pieces of information
(approximately 65 thousand).
• Byte addressable - each byte has its own address.
• 0 1 bit
• 1 1 bit
• 0110 4 bits
• 01101011 8 bits
Numbers in Bystem
• Numbers binary system
• 0 0
• 1 1
• 2 10
• 3 11
• 4 100
• 5 101
• 6 110
• 7 111
• 8 1000
• 9
Characters
• Characters. The computer also uses a single byte to represent a single character.
But just what particular set of bits is equivalent to which character? In theory we
could each make up our own definitions, declaring certain bit patterns to
represent certain characters. Needless to say, this would be about as practical as
each person speaking his or her own special language. Since we need to
communicate with the computer and with each other, it is appropriate that we
use a common scheme for data representation. That is, there must be agreement
on which groups of bits represent which characters.
• The code called ASCII (pronounced "AS-key"), which stands for American
Standard Code for Information Interchange, uses 7 bits for each character. Since
there are exactly 128 unique combinations of 7 bits, this 7-bit code can represent
only characters. A more common version is ASCII-8, also called extended ASCII,
which uses 8 bits per character and can represent 256 different characters. For
example, the letter A is represented by 01000001. The ASCII representation has
been adopted as a standard by the U.S. government and is found in a variety of
computers, particularly minicomputers and microcomputers.
Bits and Bytes
• Character Bit Byte Character Bit
Byte number
• A 01000001 65 ¼ 10111100 188
• B 01000010 66 . 00101110 46
• C 01000011 67 : 00111010 58
• a 01100001 97 $ 00100100 36
• b 01100010 98 \ 01011100 92
Binary Numbers