0% found this document useful (0 votes)
119 views

Data Representation

Data can be represented in computers in many forms such as numbers, text, graphics, and sound. Computers store data using bits and bytes which represent information numerically. Numbers are stored in binary format using combinations of 0s and 1s. Characters and text are assigned numeric codes like ASCII. Graphics are made up of pixels which have location and color properties. Sound is represented by numeric samples. The context determines how computers interpret numeric data, such as whether a byte represents text, graphics, instructions, etc. Primary memory temporarily holds active data and instructions, while secondary storage reliably saves non-active data over longer periods.

Uploaded by

Vikas Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views

Data Representation

Data can be represented in computers in many forms such as numbers, text, graphics, and sound. Computers store data using bits and bytes which represent information numerically. Numbers are stored in binary format using combinations of 0s and 1s. Characters and text are assigned numeric codes like ASCII. Graphics are made up of pixels which have location and color properties. Sound is represented by numeric samples. The context determines how computers interpret numeric data, such as whether a byte represents text, graphics, instructions, etc. Primary memory temporarily holds active data and instructions, while secondary storage reliably saves non-active data over longer periods.

Uploaded by

Vikas Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

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

• Normally we write numbers using digits 0 to 9. This is called


base 10. However, any positive integer (whole number) can
be easily represented by a sequence of 0's and 1's. Numbers
in this form are said to be in base 2 and they are called
binary numbers. Base 10 numbers use a positional system
based on powers of 10 to indicate their value. The number
123 is really 1 hundred + 2 tens + 3 ones. The value of each
position is determined by ever-higher powers of 10, read
from left to right. Base 2 works the same way, just with
different powers. The number 101 in base 2 is really 1 four +
0 twos + 1 one (which equals 5 in base 10).
Graphics
Graphics that are displayed on a computer screen consist of pixels: the tiny
"dots" of color that collectively "paint" a graphic image on a computer
screen. The pixels are organized into many rows on the screen. In one
common configuration, each row is 640 pixels long, and there are 480 such
rows. Another configuration (and the one used on the screens in the lab) is
800 pixels per row with 600 rows, which is referred to as a "resolution of
800x600." Each pixel has two properties: its location on the screen and its
color.
• A graphic image can be represented by a list of pixels. Imagine all the rows of
pixels on the screen laid out end to end in one long row. This gives the pixel
list, and a pixel's location in the list corresponds to its position on the screen.
A pixel's color is represented by a binary code, and consists of a certain
number of bits. In a monochrome (black and white) image, only 1 bit is
needed per pixel: 0 for black, 1 for white, for example. A 16 color image
requires 4 bits per pixel. Modern display hardware allows for 24 bits per
pixel, which provides an astounding array of 16.7 million possible colors for
each pixel!
• For graphics, there are several similar standards or formats. One of the original formats still in
use is called a bitmap (.bmp). Bitmaps store every pixel of the image and thus results in files
with large amounts of bytes. A simple bitmap drawing can easily exceed several megabytes.
Two other common graphics formats used on the Internet are JPEG and GIF. JPEG and GIF are
also compressed formats. This means that instead of storing every pixel, a file of this format
stores the patterns of pixels. By storing just the patterns and not every pixel, JPEG and GIF file
formats are often many times less bytes than a corresponding bitmap format of the graphic
would be. This makes JPEG and GIF much better suited to storing on the small flash cards of
digital cameras or for downloading over the relatively slow Internet.
• The size of each image becomes especially important when designing a Web page, sending
digital photographs through email, downloading pictures over the Internet, and storing
photographs on small flash cards of digital cameras or any other secondary storage device.
The primary goal of using these compressed formats such as JPEG and GIF is to shrink the file
size to as few bytes as possible without negatively altering the image quality.
• When considering Web page graphics, the compression ratio is commonly adjusted to make
the file size of a graphic smaller. The following images will provide you with an example of the
effect that different compression ratios can have on the quality of an image. Each of the
images are equal in pixels, 400x336. The original image is in the bitmap format; as previously
discussed, this format stores every pixel of the image and results in the largest file size.
Graphics as a Collection of Pixel Bytes
Instruction Data as a Byte
Sounds
• Like ASCII for characters and GIF and JPEG for pictures,
sound has several agreed-upon formats for representing
samples in bytes. WAV is a common format in which
every sample is stored, similar to the way that bitmap
stores every pixel of an image. A more common sound
format is MP3. MP3 is a compressed format, like JPEG
and GIF are compressed format for images. MP3 does
not store every sample, instead it stores only samples
that the human ear can hear and then condenses these
samples to patterns. It is these patterns that are stored
so that another computer, or MP3 player, can read them
and reproduce the sound.
Interpretation
• How Does The Computer Know What a Byte Represents?
• We have seen that the byte: 01000011 can represent the integer
67, the character 'C', a pixel with darkness level 67, a sample of a
sound with decibel level 67, or an instruction. There are other
types of data that a byte can represent too. If that same byte can
be all of those different types of data, how does the computer
know what type it is? The answer is the context in which the
computer uses the byte. If it sends the byte to a speaker, the 67th
level of sound is produced. If it sends the byte to a monitor or
printer, a pixel with the 67th level of darkness is produced, etc.
More accurately, if the byte were coded with a standard coding
technique, like ASCII for characters, GIF for pictures, and WAV for
sounds, then when the computer sends the byte to a device, the
data corresponding to that coding is produced by the device.
Primary Memory
• Primary Memory (Moderate data access): This is also known as primary
storage, primary memory, main storage, internal storage, main memory, and
RAM (Random Access Memory); all these terms are used interchangeably by
people in computer circles. Primary Memory is the part of the computer that
holds data and instructions for processing. Although closely associated with
the central processing unit, primary memory is separate from it. Primary
Memory stores program instructions or data for only as long as the program
they pertain to is in operation. Keeping these items in primary memory when
the program is not running is not feasible for three reasons:
• Most types of memory only store items while the computer is turned on; data
is destroyed when the machine is turned off.
• If more than one program is running at once (often the case on large
computers and sometimes on small computers), a single program can not lay
exclusive claim to primary memory.
• There may not be room in memory to hold the processed data.
Storage Media
• Capacity. Organisations may store the equivalent of a roomful of data on sets of
disks that take up less space than a breadbox. A simple diskette for a personal
computer holds the equivalent of 500 printed pages, or one book. An optical
disk can hold the equivalent of approximately 400 books.
• Reliability. Data in secondary storage is basically safe, since secondary storage
is physically reliable. Also, it is more difficult for unscrupulous people to tamper
with data on disk than data stored on paper in a file cabinet.
• Convenience. With the help of a computer, authorised people can locate and
access data quickly.
• Cost. Together the three previous benefits indicate significant savings in storage
costs. It is less expensive to store data on tape or disk (the principal means of
secondary storage) than to buy and house filing cabinets. Data that is reliable
and safe is less expensive to maintain than data subject to errors. But the
greatest savings can be found in the speed and convenience of filing and
retrieving data.
• Portability. Data stored in detachable secondary storage devices can be used
across various computers without much difficulty.
Secondary Storage: Type
• Basically secondary storage devices are classified
broadly into two categories.

• Sequential-access media (magnetic tape)


requires all data to be accessed serially until the
desired data is found.
• Direct-access (magnetic or optical disks) media
allows the desired data to be found by moving
the read/write head straight to it.
Sequential Storage: Features
• The following are the characteristics of sequential access
storage devices:
• No direct access, but very fast sequential access
• Resistant to different environmental conditions
• Easy to transport, store, cheaper than disk
• Before it was widely used to store application data; nowadays, it
is mostly used for backups or archives (tertiary storage).
– Magnetic Tape
– Cartridge tape
– Digital Audio Tape
Direct Access Storage Devices

• Direct access (often misleadingly called “random access”) is characteristic


of disks. Thus the idea predates computer storage, e.g. phonograph
records are direct access analogue storage. In order to store files on any
disk that disk must be formatted, i.e. initialised so that data can be stored
in an organised manner; this organisation is characteristic of the
Operating System (O.S.) being used. Therefore a Windows based
computer can not read Mac files, Unix files, etc., unless special translation
software is available. Formatting creates sectors and tracks (See below) on
which the data is stored and creates a file directory (called a file allocation
table or FAT in Windows) which is loaded into RAM along with the O.S.
when the system boots. Direct access storage is currently dominated by
magnetic media (hard disks, removable hard disks, and floppies), but
magneto-optical and read/write optical media (DVD, DVD-RAM, and
DVD+RW) promise to revolutionise storage technologies.
Magnetic Disk
Hard Disks are rigid aluminium platters coated with magnetic oxide whose
high precision provide the highest storage capacities and quickest access
rates of all magnetic media. This requires a contaminant-free
environment; if contaminants do reach the disk surface a “crash” occurs
where a scratch on the disk surface results in data loss. Hard disks,
currently reaching double digit GB ranges, have the advantage of being
the fastest mass storage but are permanent (i.e. the storage disks can
not be switched). High capacity storage units of all sizes that use sealed
housings are often called Winchester disks.
• Diskettes (“floppies”) are made of flexible Mylar plastic coated with
magnetic oxide. They come in 8, 5.25, and 3.5 inch sizes, can have single
(SD), double (DD), or high densities (HD), and can be either single- or
double-sided. Older diskettes, 5.25" DD that hold 360 KB, 3.5" DD that
hold720 KB, and 3.5" HD diskettes that hold 1.4 MB are all virtually
obsolete now because the LS-120 Super Drive (120MB) can store about
hundred times the equivalent of a HD floppy and Sony’s HiFD (200MB)
will be able to store about two hundred HD floppies! Both can read and
write standard floppy disks as well.
• Hard Cards are hard disks that are mounted directly on their interface card and fit
directly into the expansion slots on a PC motherboard.
• Cartridge disk drives are devices that accept small removable (but hermetically sealed)
disk cartridges (typically 3.5" with 10 MB to single digit GB storage capacity.) This blend
of the advantages of hard disks and floppies will, no doubt, revolutionise mass storage
in the near future.
• Magneto-optical disks (read/write/erasable) are often confusingly categorised as
optical disks because lasers are used to read data as well as facilitate writing data.
However, the data is stored magnetically in microscopic “magnetic domains”. When the
high-power laser heats the magnetic storage film the domains can be aligned in higher
densities than on regular magnetic disks, thus giving higher storage capacity than hard
disks. Data is retrieved by reflecting a low-power polarised laser beam off of the
magnetic film. The polarisation of reflected beam can be interpreted as binary data.
• i) Magneto-optical disks are removable and have removable gigabyte storage
capacities, supposedly up to 20 GB!!
• ii) The read/write capability of these disks is currently compromised by its relatively
slow access time compared to hard disks.

You might also like