You are on page 1of 40

Data Representation

• Data
• Data can be defined as facts, figures or statistics
used for reference.
• Data is a raw materials for data processing.
• Data refers unprocessed information.
• It can be numbers, figures, symbols, images etc.
Data Representation
• Data representation is defined as the methods
used to represent information in computers.
• Different types of data can be stored in
computer system.
• This includes numeric data, texts, executable
files, images, audios, videos etc.
• All types of data stored in the computer are
represented by as a sequence of zeros and
ones.
Binary System
• A binary system is a number system that has just
two unique digits, o and 1 called bits.
• A bit ( short for binary digit) is the smallest unit
of data the computer can process.
Data Types
• A data type is a classification of the type of data
that a variable or object can hold in computer
programming.
• Data types are an important factor in all
computer programming languages , including C+
+, JavaScript, Visual Basic
Examples of data types
• Integers(e.g. 2345,-234,0,78. -9)
• Real number;
• String;( bacd)
• Boolean (True or False)
• Character; ( b)
• Data( 01/12/2003)
• Double (1.797693E08)
• Floating –point number (2.345)
• Long (23456789)
Data Types
 Text data is used for data that is made up of
letters only.
 For example, password using the word
“STRONG” would be regarded as text.
 Alphanumeric data is used for data that is
made up of letter and numbers.
 For example, a password of
“STRONG3456”
Data Types
• Real number is any positive or negative number.
• This includes all integers and all rational and
irrational numbers.
• Rational numbers may be expressed by as a
fraction as
• Irrational numbers may be expressed as an
infinite decimal representation ( 2.14159)
• Real numbers are important in computing
because computers calculations involve integers
and floating –point calculations.
Data Types
• A string is any finite sequence of
characters.
• An important characteristic of each
string is its length, which is the
number of characters in it.
• Empty string is a string containing no
character and thus having a length of
zero.
Data Types
• Character is a single visual object used to
represent text, numbers , symbols.
• For example, the letter “B” is a single
character .
• With a computer , one character is equal to
one byte.
• It is sometimes abbreviated as char.
• Characters could be numbers, texts, symbols,
space etc.
Representing data
• All data within a computer are transmitted as
series of electrical signals that are either on or
off.
• For a computer to be able to process any kind
of data , including text, images and sound, it
must be converted into binary form.
Representing Text
• When any key on a keyboard is pressed, it
needs to be converted into binary number
so that it can be processed by the
computer.
• A code where each number represents a
character can be used to convert text into
binary .
• The ASCII code takes each character on
keyboard and assigns it a binary number.
Units of Data Storage
• Bits
• A bit is the smallest unit of measurement used
to quantify computer data.
• It contains a single binary value of 0 or 1
• Bits are often grouped together in 8-bits
cluster called bytes.
• It is the basic unit of data or information in a
digital computers.
Units of Data Storage
• Byte:
• Byte is a group of 8 bits used to represent a
character.
• A byte is considered the basic unit of
measuring memory size in a computer.
• A byte can store or 256 different values.
Units of Data Storage

• A nibble is half a byte, which is usually a


group of 4 bytes.
• The nibble is a unit of memory equal to
half a byte or four bits.
Units of Data Storage
• A word : two or more bits make a word.
• The term word length is used as the measure
of the number of bits in each word.
• For example, a word can have a length of 16
bits, 32 bits, 64 bits etc.
Units of Data Storage
 Kilobyte(KB) – A Kilobyte is 1,024 bytes.

 When binary data is stored in memory or fixed media,


such as hard drive, magnetic tape or CD-ROM , power –
of-two multipliers are used.
 Megabyte(MB): A Megabyte is which is 1,048,576
bytes or 1024 Kilobytes.
 Gigabyte(GB) : A Gigabyte is 1,073,741,824 () bytes,
1,024 Megabytes or 1,048,576 Kilobytes
Units of Data Storage
• Terabyte(TB) : A Terabyte is 1,099,511,627,776()
bytes, 1,024 Gigabyte or 1,048,576 Megabyte, 1
trillion bytes
• Petabyte(PB) : A Terabyte is 1,125,899,906,842,624
() bytes, 1,024 Terabytes,1,048,576 Gigabytes or
1,073,741,824 Megabytes
• Exabyte(EB): An Exabyte is
1,152,921,504,606,846,976 () bytes, 1,024
Petabytes, 1,048,576 Terabytes, 1,073,741,824
Gigabytes or 1,099,511,627,776 Megabytes
Units of Data Storage
• Zettabyte (ZB): A Zettabyte is
1,180,591,620,717,411,303,424 ( bytes, 1,024
Exabytes, 1,048,576 Petabytes, 1,073,741,824
Terabytes, 1,099,511,627,776 Gigabytes
Types of Data Representation
• Digital data
• Bits are a fundamental element of digital computing.
• A bit is the smallest unit of data that the computer
deals with.
• A bit can take two values ( 0 or 1)
• A two –state electrical switch ( transistor) is used to
represent a bit.
• In computer memory, data are stored as block of
bits( bit- patterns), the length of bit patterns is the
number of bits in the bit –patterns.
• A bit pattern of 8 bits length is called a byte.
Text Representation
• Written text is made up of alphabetical
symbols(letters) .
• Each of those symbols is represented by a
distinctive bit-pattern (code) , ex table A1,
P337
• Once alphabetical symbols are represented by
a bit pattern, any word that is made of a
combination of letters can be represented.
Coding Information using a Bit Pattern
• Code: It is a set of bit patterns designed to
represent text symbols ASCII
• EBCDIC : It is used in IBM mainframes
Extended Binary Coded Decimal Interchange
Code
A Coding Scheme
• A Coding Scheme refers to a standard, rule,
or structure that is used to convert data into
a different form.
• A Coding Scheme converts information from
one form of data to another, such as
conversion from simple Text-Based information
to Binary language.
• A computer uses Coding Schemes to convert
simple information (Text Based) into Binary
digits. Without a Coding Scheme, a computer
will be unable to process information.
A Coding Scheme
• American Standard Code for Information
Interchange (ASCII) is a -7 bit code, which means
that only 128 characters i.e. can be represented.
• ASCII is an eight –bit that specifies characters for
values from 0 to 127.
• Every single character on the keyboard has an
associated ASCII code.
• The symbolic representation of the letter A using
this coding scheme is 01000001
Extended ASCII
• Extended ASCII is an eight-bit code that
specifies the characters for values from 128 to
255.
• The first 40 symbols represent pronunciation
and special punctuation.
• The remaining symbols are graphic symbols.
Binary Coded Decimal
• In this system, one digit is represented by 4
bits.
• This is used only to represent decimal
numbers.
• Binary Coded Decimal is a 4-bit code used to
represent numeric data only.
• For example, a number like 9 can be
represented using Binary Coded Decimal as
10012
Standard Binary Coded Decimal
• This is an enhanced format of Binary Coded
Decimal which uses a 6-bit representation
scheme that can represent non-numeric
characters.
• This allows 64 characters to be represented .
• For example , letter A can be represented as
1100012 using Standard Binary Coded Decimal.
Extended Binary Coded Decimal
Interchange Code
• We can write only characters using the ASCII system,
but the EBCDIC system allows the use of 256
characters.
• Extended Binary Coded Decimal Interchange Code an
8-bit character coding scheme used primarily on IBM
computers.
• For example, the symbolic representation of letter A
using EBCDIC is 110000012
• One symbol can be written with a binary number
which consists of 8-bit.
• This system was used in IBM mainframe computers.
UNICODE
• UNICODE is a universal international coding
standard designed to represent text-based data
written in any ancient or modern language.
• Unicode uniquely identifies each character using 0s
and 1s no matter which language, program, or
computer platform is being used.
• It is a longer code , consisting of 1 to 4 bytes(8 to 32
bits) per character and can represent over one
million characters.
• When it comes to international language , there is a
need to represent a maximum of 65536 characters
uniquely.
Number Systems and their representation

• A number system is a set of symbols used to


represent values derived from a common base.
• A numbering system is a way of representing
numbers.
• The numbering system we commonly use is
called the decimal numbering system because it
uses 10 symbols.
• A system of naming or representing numbers is
known as Number System.
Number Systems
• As far as computers are concerned, number
systems can be classified into the various
major categories.
• Binary number system;
• Octal number system;
• Decimal number system,
• Hexadecimal number system.
Binary Number System.
• The term binary loosely means “two numbers
” and the two numbers associated with binary
are 1 and 0
Binary to Octal Conversion
• To convert a binary number into octal , we
follow the given steps:
i. Divide the binary digits into groups of 3
digits, starting from the right;
ii. Convert each group of binary digits into octal
digit.
Binary to Octal Conversion
• Examples,
• Convert binary number 1001012
• Answer = 458
• Convert 11101011102 to octal digit
• Answer = 16568
• Convert the 111101.01102 to octal number.
• Answer= 75.328
Conversion from Binary to Decimal
• First, write the place values starting from the
right-hand side;
• Write each digit under its place value;
• Multiply each digit by its corresponding place
value;
• Add up the products. The answer will be the
decimal number in base ten.
Conversion from Binary to Decimal
• Alternative Steps:
• Step 1: Determine the column (Positional)
value of each digit.
• Step 2: multiply the obtained column
values( Step 1) by the digits in the
corresponding columns.
• Step 3: Sum the products calculated in Step 2.
The total is the equivalent value in decimal.
Place 25 24 23 22 21 20
value

Binary 1 0 1 1 0 1
digits
Conversion from Binary to Decimal
• Convert 1011012 to base ten (decimal)
number.

You might also like