VU-Assignment CS101
VU-Assignment CS101
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
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
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.