0% found this document useful (0 votes)
54 views3 pages

Week2 - Set 4 (Thursday)

This document provides a tutorial on number system conversions between binary, decimal, octal and hexadecimal. It discusses how to convert numbers between these number systems by grouping bits or digits and assigning place values. For example, to convert a binary number to decimal, each bit is multiplied by its place value of 2 raised to the power of its position. The document also includes sample problems to convert numbers between the different number systems.

Uploaded by

Yash Motiani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views3 pages

Week2 - Set 4 (Thursday)

This document provides a tutorial on number system conversions between binary, decimal, octal and hexadecimal. It discusses how to convert numbers between these number systems by grouping bits or digits and assigning place values. For example, to convert a binary number to decimal, each bit is multiplied by its place value of 2 raised to the power of its position. The document also includes sample problems to convert numbers between the different number systems.

Uploaded by

Yash Motiani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Tutorial on Number system

Course- BTech Type- Core


Course Code- CSET101 Course Name- Computational Thinking
and Programming
Year- 2022 Semester- odd
Date- 6 October 2022 Batch- ALL

Tutorial Assignment: 1

Tutorial title: Introduction to python and Number system conversion

CO Mapping
Name CO1 CO2 CO3
Number System Conversion ✓ - -

In computer applications the Binary numbers are represented by only two symbols or digits, i.e. 0 and 1. The
binary numbers here are expressed in the base-2 numeral system. For example, (101)2 is a binary number. Each
digit in this system is said to be a bit. The Octal number system has base value equal to 8 and comprise
numbers 0 to 7. The Decimal number system is the number system that we use on a daily basis based on the
10 digits (0-9). The Hexadecimal number system number system has a base value equal to 16. containing
numbers from 0 to 9 and the capital letters A to F to represent its Binary or Decimal number equivalent.
Conversion of Binary to Other Number Systems
To convert a binary number to octal number then Group all the 1's and 0's in the binary number in
sets of three, starting from the far right. Add zeros to the left of the last digit if you don't have enough digits to
make a set of three. Add up the new numbers in each set of three. For example: 10101 2 is the binary number.
We can write the given binary number as: 010 101. Now as we know, in the octal number system, 010 → 2 and
101 → 5. Therefore, the required octal number is (25)8.
To convert the binary number to decimal is equal to the sum of binary digits (dn) times their power
of 2 (2n). For example: (10101)2 = 1 × 24 + 0 × 23 + 1 × 22 + 0 × 21 + 1 × 20 = 16 + 4 + 1 == (21)10.
To convert binary number to hexadecimal: Divide the binary digits into groups of four (starting from
right) for integer part and start from left for fraction part. Convert each group of four binary digits to one
hexadecimal digit. For example: 0001 0101 = (15)16.

Conversion of Octal to Other Number Systems


To convert the octal to binary: In order to convert the octal number into binary, we need to express
every octal value using 3 binary bits. For example (41)8 = 100 001 = (100001)2. To convert the octal to decimal:
is equal to the sum of octal digits (dn) times their power of 8 (8n). For example: 418 = (4 * 81) + (1 * 80) = 4 * 8
+ 1 * 1 = 32+1 = (33)10.
To convert the octal to hexadecimal: In order to convert the octal number into binary, we need to
express every octal value using 3 binary bits. And after that, we need to group every 4 binary bits and calculate
the value [From left to right]. For example: (41)8 = 100 001. Combine the groups = (100001)2. Divide the binary
digits from previous groups of 4 digits, starting from the right. = 0010 0001. Convert each group of 4 binary
digits into 1 hexadecimal digit. 0010 = 2, 0001 = 1, = (21)16.
Tutorial on Number system

Conversion of Decimal to Other Number Systems


To convert a decimal number to binary we need to divide the given number by 2 until the quotient is
equal to 0. We keep the remainders aside during the division process. Once the quotient is equal to zero, we
write the remainder along with the last numbers starting from the bottom to the top to obtain the binary number.
For example, (20)10 = (10000000)2

To convert decimal to octal, the decimal number is divided by 8 and record the remainders. Once the
quotient is less than 8, we obtain the octal number by writing the remainder in reverse order. For example, (45)10
= (55)8
The decimal to hexadecimal conversion is done similarly to the other two number systems. The base number
of hexadecimal is 16 so the number needs to be divided by 16 until the quotient is zero.

Conversion of Hexadecimal to Other Number Systems


To convert hexadecimal to a binary number we need to first convert the hexadecimal number to a
decimal number to finally convert it to a binary number. For example, (100)16 is converted to decimal by
multiplying each digit with 16n-1.
(100)16 = 1 × 16(3-1) + 0 × 16(2-1) + 0 × 16(1-1)
(100)16 = 1 × 162 + 0 × 161 + 0 × 160
(100)16 = (256)10
Now, convert the decimal number (256)10 to a binary number by dividing the number by 2 until the quotient is
zero.
(100)16= (100000000)2

Questions:
1. What does pip stand for python?
a) unlimited length
b) all private members must have leading and trailing underscores
c) Preferred Installer Program
d) none of the mentioned
2. Which of the following is not a core data type in Python programming?
a) Tuples
b) Lists
c) Class
d) Dictionary

3. Convert the following numbers from base 10 to base 8-


a. (172)10
b. (172.878)10

4. Convert the following numbers from base 10 to base 16-


a. (2020)10
Tutorial on Number system

b. (2020.65625)10
c. (172)10
d. (172.983)10

5. Convert the following binary pattern to their corresponding hexadecimal value.


a. 111011001
b. 101100111110
6. Convert the following decimal value to their corresponding binary.
a. 1023
b. 432
7. Convert the following binary into corresponding octal value
a. 11101110100
b. 100011001

8. Convert the following octal into corresponding hexadecimal.


(a) (154)8
(b) (13457)8

9. What least digit should come in place of # in the 9-digit number 15549#325, for which the
number is divisible by 3?
10. Convert following
a. binary number into octal representation?
a) 110111
b) 001011010
b. Convert following binary number to decimal representation.
a)110111
b)001011010
c. Convert following binary number to hexadecimal representation?
a)110111
b) 00101101

You might also like