Logic Sheet 1 Answers

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

1.1 What is the largest binary number that can be expressed with 14 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 14-digit binary number
is (0011 1111 1111 1111)2
8421 8421 8421 8421

153 15
15 15
15 15
15

For Hexadecimal { 15 = F } ∴ The Equivalent Hexa : (3FFF)16

To calculate the largest number of k bits for Equivalent Decimal


we can simply use the formula 2k -1

The Equivalent Decimal : 214 -1 = 16384-1= (16383)10

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

For Hexadecimal { 15 = F } ∴ The Equivalent Hexa : (FFFF)16


To calculate the largest number of k bits for Equivalent Decimal we can
simply use the formula 2k -1
The Equivalent Decimal : 216 -1 = 65536-1= (65535)10
1.3 What is the exact number of bytes in a system that contains (a) 32K
bytes, (b) 64M bytes, and (c) 6.4G bytes?

Answer: { K = 210 , M = 220 , G = 230 }

(a) 32 × 210 = 32768 bytes


(b) 64 × 220 = 67108864 bytes
(c) 6.4 × 230 = 6871947674 bytes

1.4 Convert the following binary numbers to decimal : 1001101,


1010011.101 and 10101110.10010.

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

0110 0100 1100 1101

8421 8421 8421 8421


= ( 0110010011001101 )2
From binary to octal : ( 0110010011001101 )2 : { take every 3 bits alone }
110 010 011 001 101

421 421 421 421 421


6 2 3 1 5

= ( 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

The second method is faster than the first one.

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 }

11×r2 + 14×r1 + 14×r0 = 2699


11r2 + 14r - 2685 = 0
r = 15 or r = -16.27 { refused } ∴ r = 15
(b) (365)r = (194)10.
3×r2 + 6×r1 + 5×r0 = 194
3r2 + 6r - 189 = 0
r = 7 or r = -9 { refused } ∴r=7
1.9 Determine the base of the numbers in each case for the following
operations to be correct:
(a) 14/2 = 5 (b) 54/4 = 13 (c) 24 + 17 = 40.

𝟏×𝒃𝟏 + 𝟒×𝒃𝟎
(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?

Notice that the solutions to the equation x2 - 11x + 22 in decimal


system are 8.37 and 2.62, which means that this equation is in another
system, we are asked to get the base of it.

( x – 3 ) ( x – 6 ) = x2 - 9x + 18

(x2 - 11x + 22)b = (x2 - 9x + 18)10


(11) b = (9)10

1×b1 + 1×b0 = 9×b0

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.

00010000 00000000 11011010 10101010 10000101 11111111


1st 11101111 11111111 00100101 01010101 01111010 00000000
complement
2nd 11110000 00000000 00100110 01010110 01111011 00000001
complement

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

a) 10011 – 10001 , 2’s complement of (10001) = ( 01111 )


1 1 1 1 1
1 0 0 1 1
+ 0 1 1 1 1

1 0 0 0 1 0

The first bit from left is a carry and it’s ignored


∴ The result = (00010)2 = (2)10
b) 100010 – 100011 , 2’s complement of (100011) = ( 011101 )
1 0 0 0 1 0
+ 0 1 1 1 0 1

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

c) 1001 – 101000 , 2’s complement of (101000) = ( 011000 )


1 1
0 0 1 0 0 1
+ 0 1 1 0 0 0

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

d) 110000 – 010101 , 2’s complement of (010101) = ( 101011 )


1
1 1 0 0 0 0
+ 1 0 1 0 1 1

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

2’s complement of - (10001) = ( 01111 )

c- 01001 + 10100

0 1 0 0 1
+ 1 0 1 0 0

1 1 1 0 1

d- 11000 – 10101 , 2’s complement of (10101) = ( 01011 )


1
1 1 0 0 0
+ 0 1 0 1 1

1 0 0 0 1 1

carry and it’s ignored

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

1.17 The state of a 12-bit register is 100010000001. What is its content if it


represents (a) Three decimal digits in BCD? (b) A binary number?

a) ( 1000 1000 0001 )BCD = ( 881 )10

b) (100010000001)2 = 1+ 128 + 2048 = 2177


_______________________________________________________________________________________
to check your answer for converting numbers visit :
https://coderstoolbox.net/number/ or
https://www.tools4noobs.com/online_tools/base_convert/
to check your answer for subtraction using 2’s complement visit :
https://atozmath.com/NumberSubComp.aspx

You might also like