Lecture 4
Lecture 4
Lecture 4
Communication Technologies
Lecture # 4
Muhammad Nasir
Department of Computer Science
CUI Lahore Campus
mnasir@cuilahore.edu.pk
The slides are adapted from the publisher’s material
Understanding Computers: Today and Tomorrow (Ch2)
&
Computer Science Illuminated (Chapter 2)
Data and Program Representation
In order to be understood by a computer, data and
programs need to be represented appropriately
Coding systems: Used to represent data and
programs in a manner understood by the computer
Digital computers: Can only understand two states,
off and on (0 and 1)
Digital data representation:
The process of representing
data in digital form so it can be
understood by a computer
2
Digital Data Representation
• Bit: The smallest unit of data that a binary
computer can recognize (a single 1 or 0)
Byte = 8 bits
Byte terminology used to express the
size of documents and other files,
programs, etc.
Prefixes are often used to express
larger quantities of bytes: kilobyte
(KB), megabyte (MB), gigabyte (GB),
terabyte (TB), etc.
3
The Binary Numbering System
Numbering system: A way of representing numbers
▪ Decimal numbering system
Uses 10 symbols (0-9)
▪ Binary numbering system
Uses only two symbols (1 and 0) to represent all possible numbers
In both systems, the position of the digits determines the
power to which the base number (such as 10 or 2) is
raised
4
The Binary Numbering System
5
Coding Systems for Text-Based Data
▪ ASCII and EBCDIC
▪ ASCII (American Standard Code
for Information Interchange):
coding system traditionally used
with personal computers
▪ EBCDIC (Extended Binary-Coded
Decimal Interchange Code):
developed by IBM, primarily for
mainframe use
6
Numbers
Natural Numbers
▪ Zero and any number obtained by repeatedly adding one to it.
7
Numbers
Integers
▪ A natural number, a negative number
8
Positional Notation
9
Positional Notation
10
Positional Notation
As a formula: R is the base
of the number
642 is 6 * 102 + 4 * 10 + 2 * 1
11
Positional Notation
What if 642 has the base of 13?
+ 6 x 132 = 6 x 169 = 1014
+ 4 x 131 = 4 x 13 = 52
+ 2 x 13º = 2 x 1 = 2
= 1068 in base 10
642 in base 13 is equivalent to 1068 in base 10
Binary
2 75
2 37 1
2 18 1
75 = 1001011
2 9 0
2 4 1
2 2 0
1 0
Converting Decimal to Binary (Float)
What is the Binary equivalent of the decimal number
75.40?
2 75 75 = 1001011
=0.40 x 2 = 0.8
=0.80 x 2 = 1.6
2 37 1 =0.60 x 2 = 1.2
=0.20 x 2 = 0.4
2 18 1 0.40 = 0110
Pick the Integer Part until term
2 9 0 become 0 or for at least 4
terms
2 4 1 75.40 = (1001011.0110)
2 2 0
1 0
Octal number system
Base 8 has 8 digits:
0,1,2,3,4,5,6,7
Converting Octal to Decimal
What is the decimal equivalent of the octal number 642?
6 x 82 = 6 x 64 = 384
+ 4 x 81 = 4 x 8 = 32
+ 2 x 8º = 2 x 1 = 2
= 418 in base 10
Converting Binary to Octal (direct)
10101011 is AB in base 16
More Conversions