Saturday , 23 November 2024

CS302 Assignments # 1 Solution Spring 2012

Q1                                                                                  Marks 5+5=10

(a) Convert the binary number 11000110 to Gray code

(b) Convert The Gray code 10101111 to binary

Q2 Fill the empty columns in the table by performing each operation against each row.                                                                                                                                                                                        Marks 10

A

B

C

D

AND

OR

NAND

NOR

0

0

0

0

0

0

0

1

0

0

1

0

0

0

1

1

0

1

0

0

0

1

0

1

0

1

1

0

0

1

1

1

1

0

0

0

1

0

0

1

1

0

1

0

1

0

1

1

1

1

0

0

1

1

0

1

1

1

1

0

1

1

1

1

 /****************** Assignment No. 1 : Solution **********************\


Q1 (a) Binary to Gray  

1          1          0          0          0          1          1          0

Step 1: Write left most bit as it is

1

Step 2: Add the left most binary digit to adjacent one

1   +     0          0          0          1          1          0

1                    0

Step 3: Add next adjacent pair

1          1   +     0          0          0          1          1          0

1          0          1

Step 4: Again add next adjacent pair and repeat until the last pair

1          1          0    +    0          0          1          1          0

1          0          1          0

Step 5: Repeat step 4

1          1          0          0   +     0          1          1          0

1          0          1          0          0

Step 6: Repeat step 4

1          1          0          0          0   +     1          1          0

1          0          1          0          0          1

Step 7: Repeat step 4

1          1          0          0          0          1   +     1          0

1          0          1          0          0          1          0

Step 8: Repeat step 4

1          1          0          0          0          1          1   +     0

1          0          1          0          0          1          0          1

So the Gray code for the binary 11000110 is 10100101

(b) Gray to Binary

Step 1: Write left most bit as it is

1        0        1        0        1        1        1        1

Gray Code      1         

Step 2: Add this gray bit to next binary bit and write the result below as arrows indicate.

1        0        1        0        1        1        1        1

1                    1

Step 3: Repeat step 2 until the last bit

1        0        1        0        1        1        1        1

1          1          0     

1        0        1        0        1        1        1        1

1          1          0          0         

1        0        1        0        1        1        1        1

1          1          0          0          1         

1        0        1        0        1        1        1        1

1          1          0          0          1          0                     

1        0        1        0        1        1        1        1

1          1          0          0          1          0          1      

1        0        1        0        1        1        1        1

1          1          0          0          1          0          1          0                     

So Binary code for the gray 10101111 is 11001010

Q2 Fill the empty columns in the table by performing each operation            against each row.              

A

B

C

D

AND

OR

NAND

NOR

0

0

0

0

0

0

1

1

0

0

0

1

0

1

1

0

0

0

1

0

0

1

1

0

0

0

1

1

0

1

1

0

0

1

0

0

0

1

1

0

0

1

0

1

0

1

1

0

0

1

1

0

0

1

1

0

0

1

1

1

0

1

1

0

1

0

0

0

0

1

1

0

1

0

0

1

0

1

1

0

1

0

1

0

0

1

1

0

1

0

1

1

0

1

1

0

1

1

0

0

0

1

1

0

1

1

0

1

0

1

1

0

1

1

1

0

0

1

1

0

1

1

1

1

1

1

0

0

 /****************** DOWNLOAD SOLUTION FROM HERE **********************\

 


Spring 2012_CS302_1_SOL

Check Also

CS302 Solved MID term Data Mega Collection by Muhammad Ishfaq

VUassignments.com upload the CS302 Solved MID term Data Mega Collection by Muhammad Ishfaq. There is a …

Leave a Reply

Your email address will not be published. Required fields are marked *

*