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

Data Representation in Computers PDF

This document discusses how different types of data are represented in computers. It explains that all digital data is stored as binary digits (bits) representing on/off states. Basic units of data storage are bits and bytes, with a byte being 8 bits. Common data types like text, numbers, images, audio, and video are represented through different encoding schemes that assign bit patterns to each symbol or component. Text can be encoded via ASCII or Unicode character sets. Images are represented as grids of pixels with bit patterns for color/intensity. Audio is stored as discrete samples of waveform heights. Video combines discrete image frames with audio at a standard frame rate.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
135 views

Data Representation in Computers PDF

This document discusses how different types of data are represented in computers. It explains that all digital data is stored as binary digits (bits) representing on/off states. Basic units of data storage are bits and bytes, with a byte being 8 bits. Common data types like text, numbers, images, audio, and video are represented through different encoding schemes that assign bit patterns to each symbol or component. Text can be encoded via ASCII or Unicode character sets. Images are represented as grids of pixels with bit patterns for color/intensity. Audio is stored as discrete samples of waveform heights. Video combines discrete image frames with audio at a standard frame rate.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Contents

Data representation in Computers ................................................................................................... 1


Bits and Bytes ................................................................................................................................. 2
1. Bits ....................................................................................................................................... 2
2. Bytes .................................................................................................................................... 2
Data Representation ........................................................................................................................ 2
1. Text ...................................................................................................................................... 2
a) ASCII ............................................................................................................................... 2
b) Unicode ............................................................................................................................ 3
2. Numbers ............................................................................................................................... 3
3. Images .................................................................................................................................. 3
4. Audio ................................................................................................................................... 4
5. Video.................................................................................................................................... 4

Data representation in Computers


Information today comes in different forms such as text, numbers, images, audio, and video. All
software, music, documents, and any other information that is processed by a computer, is stored
using binary. Data in computers are just long strings of ones and zeros like this
110101011010101011100. The digit 0 represents the electronic state of off (absence of an
electronic charge). The digit 1 represents the electronic state of on (presence of an electronic
charge).

Figure 1: Different types of data

Waqar Ahmad Khan


[email protected]
Page: 1/3
Bits and Bytes
1. Bits
Computers use binary digits (0,1) to store data. A binary digit also called a bit, is the smallest
unit of data in computing. The circuits in a computer's processor are made up of billions of
switches. The digits 1 and 0 used in binary reflect the on and off states of a switch.
2. Bytes
The byte is a unit of digital information that most commonly consists of eight bits. Historically,
the byte was the number of bits used to encode a single character of text in a computer. For this
reason, it is the smallest addressable unit of memory in many computer architectures. Modern
de-facto standard for byte size is 8 bits.

• Byte - 8 bits
• Kilobyte (KB) - 1024 bytes (1*103bytes)
• Megabyte (MB) - 1024 kilobytes (1*106bytes)
• Gigabyte (GB) - 1024 megabytes(1*109bytes)
• Terabyte (TB) - 1024 gigabytes(1*1012bytes)

It seems there are 1000 bytes in a kilobyte because "kilo" means 1000. This approximation is
fine for determining how much space a file takes up or how much disk space you have. But there
are actually 1024 bytes in a kilobyte. The reason for this is because computers are based on the
binary system. That means hard drives and memory are measured in powers of 2. For example,
20 = 1, 21 = 2, 22 = 4, 23 = 8, 24 = 16, 25 = 32, 26 = 64, 27 = 128, 28 = 256, 29 = 512, 210 = 1024
Notice how 210 is 1024. Therefore, 210 or 1024 bytes compose one kilobyte. Furthermore, 1024
kilobytes compose one megabyte, and 1024 megabytes compose one gigabyte.

Data Representation
1. Text
In computers, text is represented as a bit pattern, a sequence of bits (0s or 1s). Different sets of
bit patterns have been designed to represent text symbols. Each set is called a code, and the
process of representing symbols is called coding. In text, every word is made up of symbols or
characters. When you press a key on a keyboard, a number is generated that represents the
symbol for that key (recall input unit). This is called a code. Two standard character sets are
ASCII and Unicode.
a) ASCII
ASCII stands for American Standard Code for Information Interchange. ASCII character set is
most commonly used in computers of all types. ASCII is of two types – ASCII-7 and ASCII-8.
ASCII-7 uses 7 bits to represent a symbol and can represent 128 (27) different characters. ASCII-
8 uses 8 bits to represent a symbol and can represent 256 (28) different characters. First 128
characters in ASCII-7 and ASCII-8 are same.

Waqar Ahmad Khan


[email protected]
Page: 2/3
Table 1: ASCII representation of a sentence.

H 0100 a 0110 0001 s 0111 0011 w 0111 0111


1000 r 0111 0010 o 0110 1111 o 0110 1111
e 0110 0101 e 0110 0101 m 0110 1101 r 0111 0010
r 0111 0010 0010 0000 e 0110 0101 d 0110 0100
e 0110 0101 0010 0000 s 0111 0011
0010 0000 . 0010 1110
Here are some words.

b) Unicode
Today, the prevalent coding system is called Unicode, which uses 32 bits to represent a symbol
or character used in any language in the world. With four bytes, enough Unicode codes can be
created to represent more than 4 billion different characters or symbols. This total is enough for
every unique character and symbol in the world, including the vast Urdu, Chinese, Korean, and
Japanese character sets. In addition to world letters, special mathematical and scientific symbols
are represented in Unicode.

2. Numbers
Numbers are also represented by bit patterns. However, a code such as ASCII is not used to
represent numbers; the number is directly converted to a binary number to simplify mathematical
operations.

3. Images
Images are also represented by bit patterns. In its simplest form, an image is composed of a
matrix of pixels (picture elements), where each pixel is a small dot. The size of the pixel depends
on the resolution. For example, an image can be divided into 1000 pixels or 10,000 pixels. In the
second case, there is a better representation of the image (better resolution), but more memory is
needed to store the image. After an image is divided into pixels, each pixel is assigned a bit
pattern. The size and the value of the pattern depend on the image.

For an image made of only black-and- white dots (e.g., a chessboard), a 1-bit pattern is enough to
represent a pixel. If an image is not made of pure white and pure black pixels, we can increase
the size of the bit pattern to include gray scale. For example, to show four levels of gray scale,
we can use 2-bit patterns. A black pixel can be represented by 00, a dark gray pixel by 01, a light
gray pixel by 10, and a white pixel by 11.

There are several methods to represent color images. One method is called RGB, so called
because each color is made of a combination of three primary colors: red, green, and blue. The
intensity of each color is measured, and a bit pattern is assigned to it. Another method is called
YCM, in which a color is made of a combination of three other primary colors: yellow, cyan,
and magenta.

Waqar Ahmad Khan


[email protected]
Page: 3/3
4. Audio
Audio is by nature different from text, numbers, or images. It is continuous, not discrete. Even
when we use a microphone to change voice or music to an electric signal, we create a continuous
signal.

In above given picture of the wave, dark lines are given. Each line has a different height. That is
how waves are made up of a bunch of heights joined together. Sound data is stored in the height
of the wave. Now all we need to do is store all the individual heights of each line under the wave.
That is how sound is divided into small pieces of data.

5. Video
Video refers to the recording or broadcasting of a picture or movie. Video can either be produced
as a continuous entity (e.g., by a TV camera), or it can be a combination of images, each a
discrete entity, arranged to convey the idea of motion.

Videos is simply a combination of images and sound. There is only one thing that needs to be
added, the frame rate. That tells the video player how many images should flash per second.
The average video frame rate is about 30 frames per second.

//End

Waqar Ahmad Khan


[email protected]
Page: 4/3

You might also like