You are on page 1of 4

Introduction to Computing (CS101)

Assignment # 01

Question No.1: -

(a) Convert the above 8-digit binary numbers into decimals.


Solution: -

Binary System Representation: -

27 26 25 24 23 22 21 20

128 64 32 16 8 4 2 1

i. 01001000

We will be solving this by two different methods.


In this following method we start by adding the left most digit to 0, and
multiply that by 2 and add the next digit in the number (left to right). Like this:

(01001000)2= (0x27) +(1x26) +(0x25) +(0x24) +(1x23) +(0x22) +(0x21) +(0x20)


=0+64+0+0+8+0+0+0
(01001000)2=7210
OTHER METHOD:

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
0 1 0 0 1 0 0 0
64 8
Total = 72

ii. 01101001
(01101001)2= (0x27) +(1x26) +(1x25) +(0x24) +(1x23) +(0x22) +(0x21) +(1x20)
=0+64+32+0+8+0+0+1
(01101001)2=10510
OTHER METHOD:

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
0 1 1 0 1 0 0 1
64 32 8 1
Total = 105

iii. 00101100

(00101100)2 = (0x27) +(0x26) +(1x25) +(0x24) +(1x23) +(1x22) +(0x21) +(0x20)


=0+0+32+0+8+4+0+0
(00101100)2 =4410
OTHER METHOD:

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
0 0 1 0 1 1 0 0
32 8 4 1
Total = 45

(b) Convert the 8-digit binary into hexadecimal.


Solution: -

i. 01001000
0100 = 4 1000 =8 so hexadecimal is 48
(01001000)2 = (48)16

ii. 01101001
0110 = 6 1001=9 so hexadecimal is 69
(01101001)2 = (69)16

iii. 00101100
0010=2 1100=C so hexadecimal is 2C
(00101100)2 = (2C)16

(c) Decode the 8-digit binary in textual form. (Hint: using the ASCII table).

i. 01001000 is 72 in Decimal and in ASCII table it is H


ii. 01101101 is 105 in Decimal and in ASCII table it is I
iii. 00101100 is 44 in Decimal and in ASCII table it is ,

Textual form is HI,

Question No.2: -

Solution: -

Given final output is 0. We will start from the right side. If 0 passes through the NOT
gate from right side to left side the value 0 will change into 1. Next is AND gate as
we know that if both the inputs are 1only then the output is 1(otherwise 0) So it’s
obvious that inputs of next are 1 and 1. Next is again AND gates on both sides
(extreme left) so only if all inputs are 1 then it will give the result (that we have in
the middle) So technically now we know that input values of A, B, C and D will be
1,1,1,1.

When final output is 0, the possible states of inputs A, B, C and D would be


following:
A 1

B 1

C 1

D 1

Question No.3: -

Extensio Example Answer


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

You might also like