University Computer Science Assignment: Binary Arithmetic and Logic

Verified

Added on  2022/12/15

|5
|779
|466
Homework Assignment
AI Summary
This document provides a comprehensive solution to a computer science homework assignment focusing on binary arithmetic and logic operations. The solution includes step-by-step conversions between binary, decimal, and hexadecimal number systems, demonstrating the application of base conversions. It also covers binary arithmetic operations, such as addition and subtraction using two's complement, with detailed explanations of each step. Furthermore, the assignment addresses truth tables and logic gates, providing a clear understanding of Boolean algebra principles. The solutions are presented in a clear, concise manner, making it easy for students to understand and learn the concepts of digital logic and computer fundamentals. This assignment is a valuable resource for students studying computer science or related fields, offering practical examples and explanations of core concepts.
Document Page
Question 1:
(i) (11100010)2
Solution
Binary to decimal:
11100010 = [27 * 1] + [26 * 1] + [25 * 1] + [24 * 0] + [23 * 0] + [22 * 0] + [21 * 1] + [20 * 0]
= (226)10
Decimal to Hexadecimal:
(226)10 = ()16
Division by base 16 Quotient (Q) Remainder (R)
226/16 14 2
14/16 0 14 (E)
So (11100010)2 = (226)16 = (E2)16
(i) (010010.001)2
Solution
Conversion from ()2 to ()10
010010.001 = [20 * 0] + [21 * 1] + [22 * 0] + [23 * 0] + [24 * 1] + [25 * 0] + [2-1 * 0] + [2-2 * 0] +
[2-3 * 1]
= (18.125)10
Decimal to Hexadecimal:
(18.125)10 = ()16
For integer part
Division by base 16 Quotient (Q) Remainder (R)
18/16 1 2
1/16 1
(18)10 = (12)16
1
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
For fractional part
0.125 * 16 = 2
So (010010.001)2 = (18.125)10 = (12.2)16
Question 2
(i) (28)10 - (40) 10
Solution
(28)10 = 00011100
(40)10 = 00101000
2’s compliment of (00101000) = 11010111 + 1 = 11011000
Now adding minuend and subtrahend:
0 0 0 1 1 1 0 0
1 1 0 1 1 0 0 0
Output 1 1 1 1 0 1 0 0
Carry is 0 so 2’s compliment of the output gives desired result:
2’s compliment of (11110100) = 00001011 + 1 = 00001100
(28)10 - (40) 10 = (00001100) = (12) 10
(ii) (104)10 + (45)10
Solution
(104)10 = (01101000)2
(45)10 = (00101101)2
On adding:
0 1 1 0 1 0 0 0
0 0 1 0 1 1 0 1
Output: 1 0 0 1 0 1 0 1
2
Document Page
(104)10 + (45)10 = (10010101)2 = (149)10
(iii) (80)10 - (70)10
Solution
(80)10 = 01010000
(70)10 = 01000110
2’s compliment of (01000110) = 10111001 + 1 = 10111010
Now adding minuend and subtrahend:
0 1 0 1 0 0 0 0
1 0 1 1 1 0 1 0
Output: 1 0 0 0 0 1 0 1 0
Carry is 1 which is discarded so the result is: 00001010
(80)10 - (70) 10 = (00001010) = (10) 10
(iv) (128)10 + (35)10
Solution
(128)10 = (10000000)2
(35)10 = (00100011)2
On adding:
1 0 0 0 0 0 0 0
0 0 1 0 0 0 1 1
Output: 1 0 1 0 0 0 1 1
(128)10 + (35)10 = (10100011)2 = (163)10
3
Document Page
Question 3
(i)
Solution:
A A’ B B’ C C’
0 1 0 1 0 1 1
0 1 0 1 1 0 1
0 1 1 0 0 1 1
0 1 1 0 1 0 1
1 0 0 1 0 1 1
1 0 0 1 1 0 1
1 0 1 0 0 1 0
1 0 1 0 1 0 1
(ii)
Solution
A B C AB AAC AA’
0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 1 0 0 0 0 0
0 1 1 0 0 0 0
1 0 0 0 0 0 0
1 0 1 0 1 0 1
1 1 0 1 0 0 1
4
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1 1 1 1 1 0 1
5
chevron_up_icon
1 out of 5
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]