Number Systems
A number system is a way to represent numbers using a set of symbols
(digits). The most common number systems used in computer science are:
Number System Base Digits Used
Binary 2 0, 1
Octal 8 0–7
Decimal 10 0–9
Hexadecimal 16 0–9 and
A–F
🔹 1. Binary Number System (Base-2)
● Used internally by computers.
● Only two digits: 0 and 1
Example:
Binary number: 1011
🔹 2. Octal Number System (Base-8)
● Digits: 0 to 7
● Commonly used as a shortened form of binary.
Example:
Octal number: 17
🔹 3. Decimal Number System (Base-10)
● The standard number system we use in daily life.
● Digits: 0 to 9
Example:
🔹 4. Hexadecimal Number System (Base-16)
● Digits: 0 to 9 and A to F
● A = 10, B = 11, ..., F = 15
Example:
Conversion Between Number Systems
Decimal to Binary
Method: Repeated division by 2
Example: Convert 13 to binary
13 ÷ 2 = 6 remainder 1
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1
Answer: 1101
Binary to Decimal
Multiply each bit by power of 2 from right to left.
Decimal to Octal
Repeated division by 8.
Example: 65 to Octal
65 ÷ 8 = 8 remainder 1
8 ÷ 8 = 1 remainder 0
1 ÷ 8 = 0 remainder 1
Answer: 101 (Octal)
Octal to Decimal
Example: 123 (Octal)
Decimal to Hexadecimal
Repeated division by 16.
Example: 255 to Hex
255 ÷ 16 = 15 remainder 15 (F)
15 ÷ 16 = 0 remainder 15 (F)
Answer: FF
Hexadecimal to Decimal
Binary to Octal and Hex
● Group binary digits in sets of:
○ 3 (from right) for Octal
○ 4 (from right) for Hex
Binary to Octal Example:
Binary: 101110 → group as 000 101 110 = Octal: 2 7 6 → 276
Binary to Hex Example:
Binary: 11110000 → group as 1111 0000 = Hex: F0
Encoding Schemes
Used to represent characters as binary codes so computers can store and
transmit text.
1. ASCII (American Standard Code for Information Interchange)
● 7-bit encoding (128 characters)
● Each character = 7 bits (e.g., A = 65 = 1000001)
Example:
Character ASCII Decimal ASCII Binary
A 65 1000001
a 97 1100001
0 48 0110000
2. ISCII (Indian Script Code for Information Interchange)
● Developed in India to handle Indian languages like Hindi, Tamil, etc.
● 8-bit encoding
● Supports Devanagari, Tamil, Bengali, etc.
● Backward compatible with ASCII
Example:
● Devanagari "क" (Ka) has ISCII code: 0xA4
3. Unicode
Developed to support all languages of the world
● Has space for over 1 million characters
● There are 3 encoding schemes for Unicode
■ UTF -8
■ UTF-16
■ UTF-32
UTF(Unicode Transformation Format)
UTF-8 Most popular and widely accepted encoding scheme for Unicode.
• It is a variable length encoding scheme.
• It can represent every character in the Unicode character set(in other
words, it can encode each of the 1,112,064 code points in the Unicode
character set).
• UTF-8 uses 1- 4 bytes to represent code points depending on their size.
• Unicode code points are often written as U+<code point number>.
Code space : It refers to all the codes that an encoding scheme uses to
represent characters.
Code point : Code point refers to any one code from that cod space that
represents a single character
Example:
Character Unicode Code Point UTF-8 UTF-32
A U+0041 41 00000000 00000000
00000000 01000001
क U+0915 E0 A4 95 00000000 00000000 00001001
00010101
Summary Table
Feature ASCII ISCII Unicode (UTF-8/32)
Bits Used 7 8 Variable (8, 16, 32 bits)
Languages English Indian All languages
Character Count 128 ~256 Over 1 million
Usage Old Indian govt. Web, modern applications
systems work