Tutorial One Solutions

Question 1

a. Convert \(2AE_{16}\) to binary

To convert Hexadecimal to Binary, represent each hex digit as a 4-bit binary equivalent:

Combine the bits:

\[ 0010 \quad 1010 \quad 1110 \]

Answer: \(1010101110_2\)

b. Using two's complement add \(-23\) to \(+5\) using 8-bit system

Step 1: Convert \(+23\) to 8-bit binary
\(23 = 16 + 4 + 2 + 1 \rightarrow 00010111\)

Step 2: Find two's complement of \(23\) (to get \(-23\))
Invert bits: \(11101000\)
Add 1: \(11101000 + 1 = 11101001\)
\(-23 = 11101001\)

Step 3: Convert \(+5\) to 8-bit binary
\(+5 = 00000101\)

Step 4: Add \(-23\) and \(+5\)

11101001 (-23) + 00000101 ( +5) ----------- 11101110 (-18)

Answer: \(11101110_2\)

c. Add \(21\) to \(50\) in 8-bit system

Step 1: Convert to binary
\(21 = 00010101\)
\(50 = 00110010\)

Step 2: Perform binary addition

00010101 (21) + 00110010 (50) ----------- 01000111 (71)

Answer: \(01000111_2\)

d. Convert \(234_{10}\) to octal

Perform repeated division by 8:

DivisionQuotientRemainder
\(234 \div 8\)\(29\)2
\(29 \div 8\)\(3\)5
\(3 \div 8\)\(0\)3

Read remainders from bottom to top: \(352\)

Answer: \(352_8\)

e. What are the ranges of 8-bit, 16-bit, 32-bit and 64-bit integer?

Question 2

a. Calculate \(24 - 99\) in binary with two's complement of 8-bit

Step 1: Convert \(24\) to 8-bit binary: \(00011000\)

Step 2: Convert \(-99\) to 8-bit binary
\(+99 = 01100011\)
Invert: \(10011100\)
Add 1: \(10011101\)

Step 3: Add \(24 + (-99)\)

00011000 (24) + 10011101 (-99) ----------- 10110101 (-75)

Answer: \(10110101_2\)

b. What is the value of \(11101\) in octal?

Group bits in threes from right to left (pad with zero): \(011 \quad 101\)

Answer: \(35_8\)

c. In an 8-bit system, add \(120\) to \(55\)

Step 1: Convert to binary: \(120 \rightarrow 01111000\), \(55 \rightarrow 00110111\)

Step 2: Add

01111000 (120) + 00110111 ( 55) ----------- 10101111 (175)

Answer: \(10101111_2\)

d. Convert \(720_8\) to hexadecimal

Step 1: Octal to Binary: \(7(111)\), \(2(010)\), \(0(000) \rightarrow 111010000\)

Step 2: Binary to Hex: Group by 4s: \(0001 \quad 1101 \quad 0000\)

\(1 \rightarrow 1\), \(1101 \rightarrow D\), \(0000 \rightarrow 0\)

Answer: \(1D0_{16}\)

e. Value of various numbers in 8-bit sign-magnitude

DecimalSign-Magnitude (8-bit)
+8801011000
-8811011000
-110000001
000000000
+100000001
-12711111111
+12701111111

Question 3

a. Using one's complement, add \(-32\) to \(+15\) in an 8-bit system

Step 1: \(+32 = 00100000\). One's Complement of \(-32 = 11011111\).

Step 2: Add

11011111 (-32) + 00001111 (+15) ----------- 11101110

Answer: \(11101110_2\)

b. Calculate \(28+6\) using one's complement in an 8-bit system

Step 1: \(28 \rightarrow 00011100\), \(6 \rightarrow 00000110\)

Step 2: Add

00011100 + 00000110 ----------- 00100010

Answer: \(00100010_2\)

c. Value of various numbers in 8-bit 1's complement

DecimalOne's Complement (8-bit)
+8801011000
-8810100111 (Invert of +88)
-111111110 (Invert of +1)
000000000 (+0) or 11111111 (-0)
+100000001
-12710000000 (Invert of +127)
+12701111111

d. What is the value of \(11101\) in octal?

Group by 3: \(011 \quad 101 \rightarrow 3 \quad 5\)

Answer: \(35_8\)

e. What is the binary value of \(68_{10}\)?

Powers of 2: \(68 = 64 + 4\)

Answer: \(1000100_2\)