0% found this document useful (0 votes)
66 views

VU-Assignment CS101

The document discusses converting binary numbers to decimal and hexadecimal. It provides two methods for converting binary to decimal - positional notation and doubling method. It then shows applying these methods to convert three sample binary numbers to decimal and hexadecimal. The decoded message from converting the binary numbers to ASCII characters is "Hi'". It also briefly describes a logic circuit problem and examples of file extensions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

VU-Assignment CS101

The document discusses converting binary numbers to decimal and hexadecimal. It provides two methods for converting binary to decimal - positional notation and doubling method. It then shows applying these methods to convert three sample binary numbers to decimal and hexadecimal. The decoded message from converting the binary numbers to ASCII characters is "Hi'". It also briefly describes a logic circuit problem and examples of file extensions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

INTRODUCTION TO COMPUTING CS-101

SPRING 2022
ASSIGNMENT
Roll Number MC220203866
Q No: 1 (a)
The encoded message in binary is 01001000 01101001 00101100. It can be converted into
Decimal Using Positional Notation Method or Doubling Method.
Positional Notation Method is based on the fact that Quantity associated with each position is twice
the quantity associated with the position to its right. That means weight of positions from right to
left is 20,21, 22,23, 24,25, 26,27 for eight bit binary pattern. The Decimal Number is obtained as sum
of each binary digit multiplied by the relative positional value i.e. power of 2.
This can be easily achieved by using following table
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
For Bit Pattern 01001000
Relative position 27 26 25 24 23 22 21 20
Binary Number 0 1 0 0 1 0 0 0
Product of Bit X Bit’s Position 0*27 1*26 0*25 0*2 4
1*23 0*22 0*21 0*20
Product of Multiplication 0 64 0 0 8 0 0 0
Sum of Product = Decimal No. 64+8 = 72

For Bit Pattern 01101001


Relative position 27 26 25 24 23 22 21 20
Binary Number 0 1 1 0 1 0 0 1
Product of Bit X Bit’s Position 0*27 1*26 1*25 0*2 4
1*2 3
0*22 0*21 1*20
Product of Multiplication 0 64 32 0 8 0 0 1
Sum of Product = Decimal No 64+32+8+1 = 105
For Bit Pattern 00101100
Relative position 27 26 25 24 23 22 21 20
Binary Number 0 0 1 0 1 1 0 0
Product of Bit X Bit’s Position 0*27 0*26 1*25 0*24 1*23 1*22 0*21 0*20
Product of Multiplication 0 0 32 0 8 4 0 0
Sum of Product = Decimal No 32+8+4 = 44
An alternative Method is Doubling Method using following simple algorithm
1- Start with Most Significant Bit (Leftmost), multiply it with 2 and add the 2 nd leftmost bit with
it
2- Multiply the result of above addition with two and add the 3rd leftmost bit with it
3- Repeat the process until the least significant bit (rightmost) is added and no digit is left
Using above method we get following result
Binary No 01001000 01101001 00101100
MSB 0 0 0
2nd Leftmost bit 0 X 2 + 1 =1 0 X 2 + 1 =1 0 X 2 + 0 =0
3rd Leftmost bit 1 X 2 + 0 =2 1 X 2 + 1 =3 0 X 2 + 1 =1
4th Leftmost bit 2 X 2 + 0 =4 3 X 2 + 0 =6 1 X 2 + 0 =2
5 Leftmost bit
th
4 X 2 + 1 =9 6 X 2 + 1 =13 2 X 2 + 1 =5
6th Leftmost bit 9 X 2 + 0 =18 13 X 2 + 0 =26 5 X 2 + 1 =11
7th Leftmost bit 18 X 2 + 0 =36 26 X 2 + 0 =52 11 X 2 + 0 =22
LSB 36 X 2 + 0 =72 52 X 2 + 1 =105 22 X 2 + 0 =44
Decimal No = 72 Decimal No = 105 Decimal No = 44
INTRODUCTION TO COMPUTING CS-101
SPRING 2022
ASSIGNMENT
Roll Number MC220203866

The Encoded Message in Decimal is 01001000 01101001 00101100


72 105 44

Q-1 (B)
Binary Numbers are converted into hexadecimal notation using following simple algorithm
1- Starting from rightmost digit Binary Number is divided into pattern of 4 bits called nibbles
2- Convert each nibble into decimal
3- Convert each decimal into hexadecimal
4- Put the hex digit together
Using above Pattern we solve for each bitt pattern
1- 0100 1000
Using binary to decimal conversion method as illustrated in part (a) we get hexadecimal number as
Nibble 0100 Nibble 1000
23 22 21 20 23 22 21 20
0 1 0 0 1 0 0 0
0 4 0 0 8 0 0 0
Decimal = 4 Decimal = 8
Hexadecimal = 4 Hexadecimal = 8
(01001000)2 = (48)16
2- 0110 1001
Using binary to decimal conversion method as illustrated in part (a) we get hexadecimal number as
Nibble 0110 Nibble 1001
23
22 21 20
23
22 21 20
0 1 1 0 1 0 0 1
0 4 2 0 8 0 0 1
Decimal = 6 Decimal = 9
Hexadecimal = 6 Hexadecimal = 9
(01101001)2 = (69)16
3- 00101100
Using binary to decimal conversion method as illustrated in part (a) we get hexadecimal number as
Nibble 0010 Nibble 1100
2 3
2 2
2 1
2 0
2 3
22 21 20
0 0 1 0 1 1 0 0
0 0 2 0 8 4 0 0
Decimal = 2 Decimal = 12
Hexadecimal = 2 Hexadecimal = C
(00101100)2 = (2C)16
Encoded message in hexadecimal will be 01001000 01101001 00101100
48 69 2C
INTRODUCTION TO COMPUTING CS-101
SPRING 2022
ASSIGNMENT
Roll Number MC220203866
Q-1 (C)
The encoded message when decoded through ASCII Table will be
- Binary Number 01001000 is equal to Hexadecimal Number 48 which represent ASCII
Code for “H”
- Binary Number 01101001 is equal to Hexadecimal Number 69 which represent ASCII
Code for “i”
- Binary Number 00101100 is equal to Hexadecimal Number 2C which represent ASCII
Code for “ ’ ”.
So the decoded message will be Hi’

Question No- 2
For the given circuitry with Output equal to 0 the four input states will be following
A 1
B 1
C 1
D 1

Question No- 3

Correct Example for each of the Extension will be

Extensio Answer
n
.mp3 The audio tracks of programming talk-throughs.
.zip A compressed folder of admission documents.
.gif The logo of the Virtual University of Pakistan
.jpeg The photo of the Rector on the faculty page.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy