In: Computer Science
1-List the different ways to represent signed integers and represent (-75) in these ways.
Convert the following:
Find the two's complement for the following
2- Compute the following signed integer and determine if either there carry or overflow
=====================================
Different ways to represent signed integers are-------
1. sign and magnitude
2. 1's complement
3. 2's complement
Now represent -75 In these ways
1. sign and magnitude
so we use 7 bit to represent 75 and 1 bit for sign
(-75)10 = (11001011)2
2. 1's complement
-75 = 10110100
3. 2's complement
-75 = 10110101
====================================
Convert the following
A. (345)10 = ( )2
345/2 = 172 + 1
172/2 = 86 + 0
86/2 = 43 + 0
43/2 = 21 + 1
21/2 = 10 + 1
10/2 = 5 + 0
5/2 = 2 + 1
2/2 = 1 + 0
1/2 = 0 + 1
(345)10 = (101011001)2
B. (563)10 = ( )16
563/16 = 35 + 3
35/16 = 2 + 3
2/16 = 0 + 2
(563)10 = (233)16
C. (2AB5)16 = ( )2
2 A
B 5
0010 1010 1011 0101
(2AB5)16 = (10101010110101)2
D. (1011111100111100)2 = (
)16
1011 1111 0011 1100
B F 3 C
(1011111100111100)2 =
(BF3C)16
===========================================================================
Two's complement for the following
A. (11011101100100)2
invert the digit and add 1 to it
step 1 -Invert the digit
11011101100100
00100010011011
step2 - add 1 to the final
result
00100010011011
+ 1
00100010011100
so now two's complement of
(11011101100100)2 is 00100010011100
B. (34BC)16
To find a twos complement of hexadecimal first we have to
convert it into its binary form
3 4
B C
0011 0100 1011 1100
invert the digit and add 1 to
it
step 1 -Invert the digit
0011 0100
1011 1100
1100 1011
0100 0011
step2 - add 1 to the final
result
1100101101000011
+ 1
1100101101000100
so now two's complement of
(0011010010111100)2 is 1100101101000100
1100 1011
0100 0100
C B
4 4
So two's complement of
(34BC)16 = (CB44)16
======================================================================================
2 compute
A. (01001110)2 + (10101100)2 = ( )2
+ 1 0 0 1 1 1 0 (+ 78)
- 0 1 0 1 1 0
0
(- 44)
---------------------------------
+ 0 1 0 0 0 1
0
(+ 34)
(01001110)2 + (10101100)2 = (00100010)2
********************************************************************
B. (01111000)2+ (00110001)2 = (
)2
0 1 1 1 1 0 0 0
( 120)
+ 0 0 1 1 0 0 0
1
(49)
===================
1 0 1 0 1 0 0 1
(169)
(01111000)2+
(00110001)2 = (010101001)2
**********************************************************************
C. (00101101)2 - (01111110)2 = (
)2
45 - 126
first complement of 1111110 is
0000001
hence minud
=
0101101
first complement of subtrahend =
0000001
0101110
--------
1010001
no carry hence the difference is
negative
answer is
-1010001 (-81)