Professional Documents
Culture Documents
Logic Sheet 1 Answers
Logic Sheet 1 Answers
Logic Sheet 1 Answers
Answer:
The largest number of any k-digits binary number is that with all
digits being 1, such that the largest number of 14-digit binary number
is (0011 1111 1111 1111)2
8421 8421 8421 8421
153 15
15 15
15 15
15
1.2 What is the largest binary number that can be expressed with 16 bits?
What are the equivalent decimal and hexadecimal numbers?
Answer:
The largest number of any k-digits binary number is that with all
digits being 1, such that the largest number of 16-digit binary number
is (1111 1111 1111 1111)2
8421 8421 8421 8421
15
15 15
15 15
15 15
15
Answer:
a) (1001101)2 = 1 + 4 + 8 + 64 = (77)10
64 32 16 8421
𝟏 𝟏
b) (1010011.101)2 = + + 1 + 2 + 16 + 64 = (83.625)10
𝟖 𝟐
𝟏𝟏𝟏
64 32 16 8421
𝟐𝟒𝟖
𝟏 𝟏
c) (10101110.10010)2 = + + 2 + 4 + 8 + 32 + 128 = (174.5625)10
𝟏𝟔 𝟐
𝟏𝟏𝟏 𝟏 𝟏
128 64 32 16 8421
𝟐 𝟒 𝟖 𝟏𝟔 𝟑𝟐
1.5 Convert the hexadecimal number 64CD to binary, and then convert it
from binary to octal [ for Hexa : C = 12 & D = 13 ]
( 64CD )16
= ( 62315 )8
1.6 Convert the decimal number 431 to binary in two ways: (a) convert directly to
binary; (b) convert first to hexadecimal and then from hexadecimal to binary.
Which method is faster?
Answer:
Integer Remainder
(a)
431/2
215 1
431 = (110101111)2
107 1
53 1
26 1
13 0
6 1
3 0
1 1
0 1
Integer Remainder
(b)
431/16
26 F
431 = (110101111)2
1 A
0 1
1.7 Convert the following numbers with the indicated bases to decimal:
(a) (4210) 5 (b) (256) 12
(c) (345) 8 (d) (345) 6
Answer:
(a) 4 × 53 + 2 × 52 + 1 × 51 + 0 × 50 = (555)10
(b) 2 × 122 + 5 × 121 + 6 × 120 = (354)10
(c) 3 × 82 + 4 × 81 + 5 × 80 = (229)10
(d) 3 × 62 + 4 v 61 + 5 × 60 = (137)10
1.8 Determine the radix r for: (a) (BEE)r = (2699)10 , (b) (365)r = (194)10.
(a) (BEE)r = (2699)10 { B = 11 & E = 14 }
𝟏×𝒃𝟏 + 𝟒×𝒃𝟎
(a) = 5×b0
𝟐
b+4 = 10 , ∴ b = 10 – 4 = 6
𝟓×𝒃𝟏 + 𝟒×𝒃𝟎
(b) = 1×b1+3×b0
𝟒
𝟓𝐛 + 𝟒
=b+3
𝟒
5b + 4 = 4b + 12 , ∴ b = 12 – 4 = 8
(c) ( 2×b1 + 4×b0 ) + ( 1×b1 + 7×b0 ) = 4×b1 + 0×b0
( 2b + 4 ) + ( b + 7 ) = 4b
3b + 11 = 4b , ∴ b = 11
1.10 The solutions to the quadratic equation x2 - 11x + 22 = 0 are x = 3 and x
= 6 What is the base of the numbers?
( x – 3 ) ( x – 6 ) = x2 - 9x + 18
b+1 = 9 , ∴b=8
1.11 Convert the following binary numbers to hexadecimal and to decimal (a)
1.10010, (b) 110.010. Explain why the answer in (b) is 4 times that in (a).
(a) for Hexa take every 4 bits alone : (0001.1001)2 = 1 . (1+8) = (1.9)16
8421 8421
𝟏 𝟏
For decimal : (1.1001)2 = 1 + + = (1.5625)10
𝟐 𝟏𝟔
𝟏𝟏𝟏 𝟏
1
𝟐 𝟒 𝟖 𝟏𝟔
(b) for Hexa take every 4 bits alone : (0110.0100)2 = (2+4) . 4 = (6.4)16
8421 8421
𝟏
For decimal : (110.010)2 = 2 + 4 + = (6.25)10
𝟒
𝟏𝟏𝟏
421
𝟐𝟒𝟖
(b) is 4 times than (a) because 1.10010 is shifted to the left by 2 places .
1.12 Obtain the 1’s and 2’s complements of the following binary numbers:
(a) 00010000 (b) 00000000 (c) 11011010
(d) 10101010 (e) 10000101 (f) 11111111.
1.13 subtract the following unsigned numbers using the 2’s complement then
convert the result to decimal number: (a) 10011-10001 (b) 100010-100011
(c) 1001-101000 (d) 110000-1010
1 0 0 0 1 0
1 1 1 1 1 1
it’s starting with 1 , so we should get the 2’s complement of the result
2’s complement of (111111) = ( 000001 )
∴ The result = (000001)2 = (1)10
1 0 0 0 0 1
it’s starting with 1 so we should get the 2’s complement of the result
2’s complement of (100001) = ( 011111 )
∴ The result = (011111)2 = 1 + 2 + 4 +8 + 16 = (31)10
1 0 1 1 0 1 1
The first bit from left is a carry and it’s ignored
∴ The result = (011011)2 = 1+2+8+16 = (27)10
1.14 the following 5-bits signed numbers and state whether the result is
positive or negative. State if there is an overflow or underflow conditions
a-10011 + 10001
1 1 1
1 0 0 1 1
+ 1 0 0 0 1
1 0 0 1 0 0
detects the negative sign
= - ( 00100 )2 = ( -4 )10
b- 00110 – 10101 , 2’s complement of (10101) = ( 01011 )
1 1 1
0 0 1 1 0
+ 0 1 0 1 1
1 0 0 0 1
c- 01001 + 10100
0 1 0 0 1
+ 1 0 1 0 0
1 1 1 0 1
1 0 0 0 1 1
1.15 Add and multiply the following numbers without converting them to
decimal.
(a) Binary numbers 1011 and 101.
(b) Hexadecimal numbers 2E and 34
a- Addition : Multiplication
1 1 1 1 1011
1 0 1 1 101 ×
______________
+ 0 1 0 1
1011
1 0 0 0 0 00000
10111
______________
110111
b) Addition Multiplication
1
2E 2E ×
34 + 34
62 38
80 +
B8
2A0 +
600
958
1.16 Represent the decimal numbers 694 and 835 in BCD, and then show the
necessary steps to get the sum of them.
694 + 835 = 1529
(694)10 = ( 0110 1001 0100 )BCD
(835)10 = ( 1000 0011 0101 )BCD
1
0110 1001 0100
+1000 0011 0101
1 1 1 1
1110 1100 1001 + 6 to the 4 bits that is bigger than 9
+ 0110 0110
_______________
0001 0101 0010 1001 = (1529)10