Kingdom of Saudi Arabia Ministry of Higher Education Majma’ah University College of Engineering EE & CEN Logic Design (CE 207, CE 213) Chapter No. 1 – Part No. 1 Problem 1.1: List the Octal and Hexadecimal numbers from 16 to 32. Sol: Decimal (Base – 10): 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 Octal (Base – 8): 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 40 Hexadecimal (Base – 16): 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F, 20 Problem 1.2: What is the exact number of bytes in a system that contains? a) 32 Kbytes Sol: As 1 Kilo (K) is referred as 210 32 Kbytes = 32 x 210 = 32 x 1024 = 32768 Bytes b) 44 Mbytes Sol: As 1 Mega (M) is referred as 220 44 Mbytes= 64 x 220 = 32 x 1048576 = 67108864 Bytes c) 6.4 Gbytes Sol: As 1 Giga (G) is referred as 230 6.4 Gbytes = 6.4 x 230 = 32 x 1073741824 = 6871947673.6 Bytes Page 1 of 7 Problem 1.3: Convert the following numbers with the indicated base to decimal. a) (4310)5 Sol: (4310)5 = 4 x 53 + 3 x 52 + 1 x 51 + 0 x 50 (4310)5 = 4 x 125 + 3 x 25 + 1 x 5 + 0 x 1 (4310)5 = 500 + 75 + 5 + 0 (4310)5 = (580)10 b) (198)12 Sol: (198)12 = 1 x 122 + 9 x121 + 8 x 120 (198)12 = 1 x 144 + 9 x12 + 8 x 1 (198)12 = 144 + 108 + 8 (198)12 = (260)10 c) (735)8 Sol: (735)8 = 7 x 82 + 7 x 81 + 7 x 80 (735)8 = 7 x 64 + 7 x 8 + 7 x 1 (735)8 = 448 + 56 + 7 (735)8 = (511)10 d) (525)6 Sol: (525)6 = 5 x 62 + 2 x 61 + 5 x 60 (525)6 = 5 x 36 + 2 x 6 + 5 x 1 (525)6 = 180 + 12 + 5 (525)6 = (197)10 Page 2 of 7 Problem 1.4: What is the largest number that can be expressed with 14 – bits? What are the equivalent decimal and hexadecimal numbers? Sol: Largest 14 – bits binary number = 11111111111111 Decimal equivalent number = 214 – 1 = 16384 – 1 = (16383)10 Hexadecimal equivalent number = (11111111111111)2 = 0011 1111 1111 1111 = (3FFF)16 Problem 1.7: Convert the Hexadecimal number 68BE to Binary and then convert it from Binary to Octal. Sol: Hexadecimal to Binary: (68BE)16 = 6 8 B E = 0110 1000 1011 1110 = (110100010111110)2 Binary to Octal: (110100010111110)2 = 110 100 010 111 110 = 6 4 2 7 6 = (64276)8 Problem 1.8: Convert the decimal number 431 to binary number in two ways. a) Convert directly to Binary: Sol: Therefore (431)10 = (110101111)2 Page 3 of 7 b) Convert first to Hexadecimal and then from Hexadecimal to Binary: Sol: Decimal to Hexadecimal: Therefore (431)10 = (1AF)16 Hexadecimal to Binary: (1AF)16 = 1 A F = 0001 1010 1111 = (10101111)2 Problem 1.9: Express the following numbers in decimals. a) (10110.0101)2 Sol: (10110.0101)2 = 1 x 24 + 0 x 23 + 1 x 22 + 1 x 21 + 0 x 20 + 0 x 2-1 + 1 x 2-2 + 0 x 2-3 + 1 x 2-4 (10110.0101)2 = 1 x 16 + 0 + 1 x 4 + 1 x 2 + 0 + 0 + 1/4 + 0 + 1/16 (10110.0101)2 = 16 + 4 +2 + 0.25 + 0.0625 (10110.0101)2 = (22.3125)10 b) (16.5)16 Sol: (16.5)16 = 1 x 161 + 6 x 160 + 5 x 16-1 (16.5)16 = 1 x 16 + 6 x 1 + 5 x 1/16 (16.5)16 = 16 + 6 + 0.3125 (16.5)16 = (22.3125)10 Page 4 of 7 c) (26.24)8 Sol: (26.24)8 = 2 x 81 + 6 x 80 + 2 x 8-1 + 4 x 8-2 (26.24)8 = 2 x 8 + 6 x 1 + 2 x 1/8 + 4 x 1/64 (26.24)8 = 16 + 6 + 0.25 + 0.0625 (26.24)8 = (22.3125)10 d) (FAFA.B)16 Sol: (FAFA.B)16 = 15 x 163 + 10 x 162 + 15 x 161 + 10 + 160 + 11 x 16-1 (FAFA.B)16 = 15 x 4096 + 10 x 256 + 15 x 16 + 10 + 1 + 11 x 1/16 (FAFA.B)16 = 61440 + 2560 + 240 + 10 + 0.6875 (FAFA.B)16 = (64250.6875)10 Problem 1.10: Convert the following numbers from Binary to Hexadecimal and then from Hexadecimal to Decimal. A. (1.10010)2 Sol: Binary to Hexadecimal: (1.10010)2 = 0001.1001 (1.10010)2 = 1 . 9 (1.10010)2 = (1.9)16 Hexadecimal to Decimal: (1.9)16 = 1 X 160 + 9 X 16-1 = 1 X 1 + 9 X 1/16 = 1 + 0.5625 (1.9)16 = (1.5625)10 B. (110.0101)2 Sol: Binary to Hexadecimal: (110.0101)2 = 0110.0101 (110.0101)2 = 6 . 5 (110.0101)2 = (6.5)16 Hexadecimal to Decimal: (6.5)16 = 6 X 160 + 5 X 16-1 = 6 X 1 + 5 X 1/16 = 6 + 0.3125 (6.4)16 = (6.3125)10 Page 5 of 7 Problem 1.13: Do the following conversions. a) Convert Decimal 27.315 to Binary Sol: Convert 27 and 0.315 separately from Decimal to Binary: 0.315 x 2 = 0.63 0 0.63 x 2 = 1.26 1 0.26 x 2 = 0.52 0 0.52 x 2 = 1.04 1 (27)10 = (11011)2 (27.315)10 = (11011.0101)2 (0.315)10 = (0.0101)2 b) Calculate the Binary equivalent of 2/3 up to eight places. Then convert from Binary to Decimal. How close is the result to 2/3? Sol: Decimal to Binary: (2/3)10 = (0.66666666)10 0.66666666 x 2 = 1.33333333 1 0.33333333 x 2 = 0.66666666 0 0.66666666 x 2 = 1.33333333 1 0.33333333 x 2 = 0.66666666 0 0.66666666 x 2 = 1.33333333 1 0.33333333 x 2 = 0.66666666 0 0.66666666 x 2 = 1.33333333 1 0.33333333 x 2 = 0.66666666 0 (2/3)10 = (0.66666666)10 = (0.10101010)2 Binary to Decimal: (0.10101010)2 = 1 x 2-1 + 0 x 2-2 + 1 x 2-3 + 0 x 2-4 + 1 x 2-5 + 0 x 2-6 + 1 x 2-7 + 0 x 2-8 (0.10101010)2 = 1/2 + 0 + 1/8 + 0 + 1/32 + 0 + 1/128 + 0 (0.10101010)2 = 0.5 + 0.125 + 0.03125 + 0.0078125 (0.10101010)2 = (0.6640625)10 Page 6 of 7 c) Convert the Binary result in part (b) to Hexadecimal and then convert the result to Decimal. Is the answer the same? Sol: Binary to Hexadecimal: (0.10101010)2 = 0.1010 1010 (0.10101010)2 = A A (0.10101010)2 = (0.AA)16 Hexadecimal to Decimal: (0.AA)16 = 10 x 16-1 + 10 x 16-2 (0.AA)16 = 10 x 1/16 + 10 x 1/256 (0.AA)16 = 10 x 0.0625 + 10 x 0.0039062 (0.AA)16 = 0.625 + 0.0390625 (0.AA)16 = (0.6640625)10 Page 7 of 7