Module 2: Digital Data:
Number Systems
Dr. Bhagwan Das
21 / 02 / 2025
From Last Week
Introduction
• Computer organisation based on how it represents numbers, characters, and control
information.
• Computers can store and manipulate numbers and characters.
• Basic unit of information in a digital computer is called a bit, which is a contraction of
binary digit. [example?]
• In 1964, the designers of the IBM System/360 mainframe computer using groups of 8-
bits as a byte.
Introduction
• Words can be 16-bits, 32-bits, 64-bits, or any other size that makes sense in the
context of a computer’s organisation (including sizes that are not multiples of eight).
• A (8-bits) byte can be divided into two 4-bits halves called nibbles (or nybbles).
• Positional numbering system, the nibble containing the least-valued binary digits is
called the low-order nibble, and the other half the high-order nibble.
Positional Numbering Systems
• Numeric value is represented through increasing powers of a
radix (or base), also known as a weighted number system.
• In 16th Century Europe embraced the (base 10 ) system used
by Arab and Hindu since Millennium
• Today we understand 243 in easy manner is 2 is H, 4 T, 3 O as
granted
• Say 0 is nothing and 1, 10 everyone know
Positional Numbering Systems
• Idea behind PN System is Increasing power of radix (base) because
each position is power by radix (base)
• Set of Valid Number of PNS is equal to the Radix size
• 10 digit (0,1,2,…. 9) (3310) if no subscript means decimals
• If 3 digit (base will be 3) (0,1,2)
• 234.5110 = 2x3+
• 2123 = 2x32+1x31+2x30=2310
• 101102 = 1x24+?=2210
• Most Powerful System
• Base 2 (Binary) [ ?]
• Base 8 (octal) [ ?]
• Base 16 (Hexadecimal) [?]
Why Binary and Hexa are focused?
Keep this question in mind.
Decimal to Binary
101011100
• 34810 to 3482
LSB
• 348 / 2 = 174 with remainder 0 ? Did you Got Something
174 / 2 = 87 with remainder 0 Interesting
87 / 2 = 43 with remainder 1
43 / 2 = 21 with remainder 1 Previously we have 10 base
21 / 2 = 10 with remainder 1
10 / 2 = 5 with remainder 0
now 2
5 / 2 = 2 with remainder 1
2 / 2 = 1 with remainder 0 One Issue in this ?
1 / 2 = 0 with remainder 1 MSB
Decimal to Octal
? Did you Got
Something Interesting
it is also used as a shorthand for representing file
permissions on UNIX systems and representation of
UTF8 numbers, etc.
• 5348
Decimal to Hexa
• 34810 to ?16
• 348 / 16 = 21.75 = 21 R 12
• 21 / 16 = 1.3125 = 1 R 5
• 1 / 16 = = 0 R1 ? Did you Got Something Interesting
•HTML / CSS Colour Codes Hexadecimal numbers are
often used to represent colours within HTML or CSS.
• The 6 digit hex colour code should be considered in
•1 5 (12 ) three parts.
• MAC Addresses A Media Access Control (MAC) address
• A = 10, B = 11, 12 = C is a number which uniquely identifies a device on the
internet
•15C16 • Assembly Code and Memory Dumps Hexadecimals are
beneficial (over binary) because: ...
•Google Color Picker
•Address memory
• 319 to Binary
• 1011 to Decimal
• Hexadecimal to Decimal (7C16) to (?)10
• = 7x161 + Cx162=7x16+12x1
• Decimal to Hexadecimal = (22)10 to(?)16
• = 22/16 (1- 6) = 1616
• Binary to Hexadecimal = (1101)2 = 23+ 22+ 21+20 = (13)10 = D
• Binary to Decimal and Decimal to hexadecimal
• 110011 to breaking in to groups of 4
• Hexadecimal to Binary = (5C)16 to Binary
• – 5 (12) -- 0101 1100
Binary Athematic
• 0+1=1
• 1+0=1
• 0+0=0
• 1 + 1 = 10 (1 is carry)
• 1 + 1 + 1 = 11
• Binary (01) + Binary 2(10)
• 01
• +
• 11
• =11
2’s Complement
• Write +5 in Binary (8-bit) • Verifying -5 with Two’s Complement
• 00000101 (5 in binary) • To convert 11111011 back to decimal:
• Take the two’s complement again (invert
• Find the One’s Complement (Invert the bits) bits and add 1):
• 11111010
11111011 → 00000100 (invert bits)
• Add 1 to Get the Two’s Complement → 00000101 (add 1)
• 11111011 (-5 in two’s complement)
Convert 00000101 to decimal → 5,
• So, in an 8-bit system: so the original number was -5.
•5 is represented as: 00000101
•-5 is represented as: 11111011
Hardware and Software (1 of 18)
Concept:
The physical devices that a computer is made of
are referred to as the computer’s hardware. The
programs that run on a computer are referred to as
software.
Hardware and Software (2 of 18)
Hardware
• The physical devices that a computer is made of are
referred to as the computer’s hardware.
• A computer is a system of devices that work together.
How Computers Store Data (1 of 9)
Concept:
All data that is stored in a computer is converted to sequences of 0s and 1s.
How Computers Store Data (2 of 9)
• A computer’s memory is divided into tiny storage locations known as bytes
• One byte represents one number
• A byte is divided into eight smaller storage locations known as bits (binary
digits)
• Bits are tiny electrical components that can hold either a positive or a
negative charge.
• A positive charge is similar to a switch in the on position
• A negative charge is similar to a switch in the off position
Figure 1-6 Think of a byte as eight
switches
How Computers Store Data (3 of 9)
Storing Numbers
• The positive charge or the on position is represented by the digit 1
• The negative charge or the off position is represented by the digit 0
• This corresponds to the binary numbering system where all numeric
values are written as a sequence of 0s and 1s
• Each digit in a binary number has a value assigned to it
Figure 1-8 The values of binary digits as
powers of 2
How Computers Store Data (4 of 9)
For example:
Figure 1-10 Determining the Figure 1-11 The bit pattern for
value of 10011101 157
How Computers Store Data (5 of 9)
• The largest value that can be stored in a byte with eight
bits is 255
• Two bytes are used for larger numbers; maximum value
is 65535
Figure 1-12 Two bytes used for a large number
How Computers Store Data (6 of 9)
Storing Characters
• Characters are stored in the computer’s memory as
binary number
• ASCII (American Standard Code for Information
Interchange) is a coding scheme
Figure 1-13 The letter A is stored in memory as the number 65
How Computers Store Data (7 of 9)
• ASCII is a set of 128 numeric codes
• ASCII is limited
• Unicode is an extensive encoding scheme
– It is compatible with ASCII
– It represents characters for many languages in the
world
How Computers Store Data (8 of 9)
Advanced Number Storage
• Binary numbering system can be used to represent only
integer numbers
• Negative numbers are encoded using two’s
complement
• Real numbers are encoded using floating-point
notation
How Computers Store Data (9 of 9)
Other Types of Data
• Digital data is data that is stored in binary
• A digital device is any device that works with binary data
• Digital images are composed of tiny dots of color known
as pixels (picture elements)
• Digital sound is broken into small pieces known as
samples
How a Program Works
• Fetch-decode-execute
Figure 1- The fetch-decode-execute
cycle is the term used
cycle
when the CPU executes
the instructions in a
program.
• The cycle consist of
three steps:
– Fetch
– Decode
– Execute
How a Program Works
From Machine Language to Assembly Language
• Computers only understand machine language
• Machine language is difficult to write
• Assembly language uses short words that are known as
mnemonics
• Assembler is used to translate an assembly language
program to machine language
How a Program Works
Figure 2- An assembler translates an assembly language program to a
machine language program
How a Program Works
High-Level Languages
• Assembly language is referred to as a low-level
language High-level languages allow you to create
powerful and complex programs without knowing how the
CPU works, using words that are easy to understand.
For example:
Java, C++, Python, Visual Basic, C# , Ada, Fortran
Do you know of any other high-level computer
programming languages?
Data Storage in Computer
Your Data Computer Data
010101011010101011101110101
010101010101010101011111000
000110101010111111000000101
010101010111111110011011001
010101010101111111101010110
110101010111110101011011101
101011101110110111011101110
111010110101010101010101010
101101010101010101010101010
Sequence of 0’s and 1’s
All data in a computer is stored in sequences of 0s and 1s.
Storing Character
• Characters are converted to numeric code, numeric
code stored in memory. Two popular schemes:
• ASCII (American Standard code for Information Interchange)
• ASCII is limited: defines codes for only 128 characters
• Unicode coding scheme becoming standard
• Compatible with ASCII
• Can represent characters for other languages
Storing Character
• Characters → numeric code → Binary (in memory)
A → 65 → 01000001
B → 66 → 01000010
a → 97 → 01100001
Character representation in ASCII
https://www.ascii-code.com/
How Computer Program Works?
• CPU designed to perform simple operations on pieces of data such as
• Perform arithmetic operations such as adding, subtracting, multiplying, and
dividing numbers
• Perform logical operation such as AND, OR and NOT
• Logical operation are usually used for comparison.
• Understands instructions written in machine language and included in its
instruction set
• Each brand of CPU has its own instruction set
• To carry out meaningful calculation, CPU must perform many
operations
How Computer Program Works?
Programs
(Set of Instructions) Output
Main Memory CPU
(Performs the
Programs are coping Instructions)
from secondary storage
to Main Memory Machine Language Instruction
(in 0’s and 1)
Hard drives
• Thank you for Today!!