CS 101 Assignment # 01: Solution
CS 101 Assignment # 01: Solution
CS 101 Assignment # 01: Solution
Name:Noor Khalid
Student ID:bc200403053
Question No. 1
Convert the following decimal numbers into equivalent binary numbers and then convert the
binary answer back into equivalent decimal. Show all the steps of conversions.
4789
-8735
Solution:
4789
2 4789 1
2 2394 0
2 1197 1
2 598 0
2 299 1
2 149 1
2 74 0
2 37 1
2 18 0
2 9 1
2 4 0
2 2 0
2 0 1
4789 10010101101012
(1001010110101)2 1 212 0 211 0 210 1 29 0 28 1 27
0 26
(1001010110101)2 1 25 1 24 0 23 1 22 0 21 1 20
4096 0 0 512 0 128 0 32 16 0 4
0 1
10010101101012 4789
-8735
2 8735 1
2 4367 1
2 2183 1
2 1091 1
2 545 1
2 272 0
2 136 0
2 68 0
2 34 0
2 17 1
2 8 0
2 4 0
2 2 0
2 0 1
10001000011111
Extend Binary sequence
0010001000011111
1101110111100000
Add 1
1101110111100000
1
1101110111100001
8735 11011101111000012
11011101111000012 1 215 1 214 0 213 1 212 1 211 1 210 0 29
1 28
1 27 1 26 1 25 0 24 0 23 0 22 0 21 1
20
11011101111000012 32768 16384 0 4096 2048 1024 0 256 128
64
32 0 0 0 0 1
11011101111000012 8735
Question No. 2
(𝑨 ⊕ 𝑫)
.
(𝑩̅ + 𝑪̅ )⊕ (𝑨 ⊕ ( 𝑨 + 𝑩)
A B C D 𝑨⊕ 𝑨+ ̅ ̅
(𝑩 + 𝑪 (𝑩 + 𝑪 + 𝑫) 𝑫) .
𝑫 𝑩 ) (𝑩 + 𝑪 + 𝑫) . ((𝑩̅ + 𝑪̅ )
(𝑨 + 𝑩 ) ⊕
(𝑩 + 𝑪 + 𝑫))
0 0 0 0 0 0 1 0 1 0 0
0 0 0 1 1 0 1 1 0 0 0
0 0 1 0 0 0 1 1 0 0 0
0 0 1 1 1 0 1 1 0 0 0
0 1 0 0 0 1 1 1 0 0 0
0 1 0 1 1 1 1 1 0 1 0
0 1 1 0 0 1 0 1 1 0 0
0 1 1 1 1 1 0 1 1 1 1
1 0 0 0 1 1 1 0 1 1 1
1 0 0 1 0 1 1 1 0 0 0
1 0 1 0 1 1 1 1 0 1 0
1 0 1 1 0 1 1 1 0 0 0
1 1 0 0 1 1 1 1 0 1 0
1 1 0 1 0 1 1 1 0 0 0
1 1 1 0 1 1 0 1 1 1 1
1 1 1 1 0 1 0 1 1 0 0