0% found this document useful (0 votes)
29 views17 pages

Lecture#4

The document discusses different data representation methods used in computers including number systems, bits and bytes, and text codes. It describes binary, decimal, octal and hexadecimal number systems. It also explains bits, bytes, BCD code, ASCII code, EBCDIC code and Unicode for representation of text data in computers.

Uploaded by

nauman khan
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)
29 views17 pages

Lecture#4

The document discusses different data representation methods used in computers including number systems, bits and bytes, and text codes. It describes binary, decimal, octal and hexadecimal number systems. It also explains bits, bytes, BCD code, ASCII code, EBCDIC code and Unicode for representation of text data in computers.

Uploaded by

nauman khan
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/ 17

Object Oriented Programming (CSC241 )

Introduction to ICT

HOW COMPUTER
REPRESENT DATA?
Lecture#4

COMSATS University Islamabad, Abbottabad Campus


TABLE OF CONTENTS

 Data Representation:
1. Number Systems (Data representation of numbers)
2. Bits & Bytes
3. Text Codes (Data representation of characters)
 Types of coding scheme
1. BCD Code
2. ASCII Code
3. EBCDIC Code
4. Unicode

Tutor::Dr. Fiaz Gul Khan COMSATS University Islamabad Abbottabad Campus 2


DATA REPRESENTATION

 Analog signals are continuous and vary in strength and quality


 Digital signals are in one of two states: on or off
 Most computers are digital
 Computer does not understand human language. Any data, viz., letters, symbols,
pictures, audio, videos, etc., fed to computer should be converted to machine
language first.
 The binary system uses two unique digits (0 and 1)
 Computers represent data in the following three forms −
1. Number System
2. Bit and Bytes
3. Text Code
COMSATS University Islamabad Abbottabad Campus 3
NUMBER SYSTEM

 A set of values used to represent different quantities is known as number system.


 For example, a number system can be used to represent the number of students in a class.
 Digital computer represents all kind of data and information in binary numbers
 i.e. text, numbers, audio , graphics etc
 To a computer, everything is a number
 Total number of digits used in a number system is called its base or radix.
 Base is written after the number as a subscript such as 512 10
 Important number systems are as follows:
1. Decimal number system
2. Binary number system
3. Octal number system
4. Hexadecimal number system

COMSATS University Islamabad Abbottabad Campus 4


CONT…

COMSATS University Islamabad Abbottabad Campus 5


BITS AND BYTES

 Bits :
 The word bit is short for binary digit.
 A bit consists of one of two values, 0 or 1 .
 A bit is a smallest unit of data in a computer.
 Bytes:
 Eight bits grouped together as a unit are called a byte.
 A byte represents a single character in the computer .

COMSATS University Islamabad Abbottabad Campus 6


CONT…

 The following table shows conversion of Bits and Bytes −

COMSATS University Islamabad Abbottabad Campus 7


TEXT CODE

 Text code is format used commonly to represent alphabets, punctuation marks and other
symbols. Four most popular text code systems are −
 Different combination of 0 and 1 are used to represent different characters
 Data is converted to binary form before it is stored inside the computer
 The process of converting data into binary form is known as encoding
 Representation of all numeric and non-numeric data in binary digits is known as computer code
 Different coding schemes/text code system are used to represent different characters
 BCD
 EBCDIC
 ASCII
 Extended ASCII
 Unicode

COMSATS University Islamabad Abbottabad Campus 8


BCD CODE

 Stands for Binary Coded Decimal


 Represent decimal digits (0-9) in binary
 4-bit code
 Means each decimal digit is represented by 4 binary digits
 Used by early computers

COMSATS University Islamabad Abbottabad Campus 9


CONT…

 Example:
 converts decimal 425 to BCD form
 4=0100
 2=0010
 5=0101
 So, BCD form of the decimal number 425 = 010000100101

COMSATS University Islamabad Abbottabad Campus 10


ASCII CODE

 Stands for American Standard Code for Information Interchange


 Published in 1968 by ANSI(American National Standard Institute)
 Widely used in personal computers
 7 bits are sufficient to represent 128 character in ASCII (0-127 values)
 most computers typically reserve 1 byte, (8 bits), for an ASCII character.
 8 bits represent 256 characters
 Extended 128 unique codes represent graphic symbols
 ASCII is of two types
1. ASCII-7
2. ASCII-8

COMSATS University Islamabad Abbottabad Campus 11


CONT…

 ASCII-7: uses 7 bits to represent a symbol and can represent 128 different
characters
 ASCII-8: uses 8 bits to represent a symbol and can represent 256 different
characters
 Example: Write binary coding for the word BOY on ASCII-7
 Ans: B = 1000010, O=1001111 , Y= 1011001
 BOY = 100001010011111011001

COMSATS University Islamabad Abbottabad Campus 12


CONT…

COMSATS University Islamabad Abbottabad Campus 13


EBCDIC CODE

 Stands for Extended Binary Coded Decimal Interchange Code


 8-bit code
 It is divided into two groups of 4 bits
 Each group can represent one hexadecimal code
 Used in mainframe computers
 Represent 256 characters
 Convert the following:

COMSATS University Islamabad Abbottabad Campus 14


CONT…

COMSATS University Islamabad Abbottabad Campus 15


UNICODE

 16-bits code
 Represent 65536 characters
 Started to replace ASCII code
 Represents the characters of all languages in the world

COMSATS University Islamabad Abbottabad Campus 16


THANKS

COMSATS University Islamabad Abbottabad Campus 17

You might also like