Assignment Four 1
Assignment Four 1
ASSIGNMENT FOUR
=100111012
3. Convert the hexadecimal number 3F4A₁₆ to decimal.
= FF16
=7108
Advanced Base Conversion and Arithmetic
=110002
12. Perform binary subtraction: 10001₂ - 1010₂.
-
1 0 0 0 1
1 0 1 0
1 0 1 1
=10112
13. Convert the hexadecimal number 1ABF₁₆ to octal.
We Convert each hex digit to 4 binary digits and then convert
each 3 binary digits to octal digits as;
1ABF
=1ABF
= 1 1010 1011 1111
= 1 101 010 111 111
=15277
= 152778
14. Perform hexadecimal addition: A5₁₆ + 3E₁₆.
A516= 10*16^1 + 5*16^0
=16510
3E16=3*16^2 + 14*16^1
=6210
=16510 + 6210
=22710
22710 =E316
=E316
15. Convert the decimal number 1023 to binary and hexadecimal.
Divide by the base 2 to get the digits from the remainders:
Division Quotient Remainder
by 2 (Digit)
(1023)/2 511 1
(511)/2 255 1
(255)/2 127 1
(127)/2 63 1
(63)/2 31 1
(31)/2 15 1
(15)/2 7 1
(7)/2 3 1
(3)/2 1 1
(1)/2 0 1
= 11111111112
Divide by the base 16 to get the digits from the remainders:
Division Quotient Remainder
by 16 (Digit)
(1023)/16 63 15
(63)/16 3 15
(3)/16 0 3
= 3FF16
238=2×8^1+3×8^0=2×8+3×1=16+3=1910
=1910
5₈.=5×8^0=510
=1910*510=9510
238×58=13716
18. Perform binary multiplication: 1011₂ × 110₂.
(1011)₂ = (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰) = 11₁₀
(110)₂ = (1 × 2²) + (1 × 2¹) + (0 × 2⁰) = 6₁₀
= 11₁₀ * 6₁₀
= 6610
Divide by the base 2 to get the digits from the remainders:
Division Quotient Remainder
by 2
(Digit)
(66)/2 33 0
(33)/2 16 1
(16)/2 8 0
(8)/2 4 0
(4)/2 2 0
(2)/2 1 0
(1)/2 0 1
= 10000102
Convert each hex digit to 4 binary digits and then convert each 3 binary digits to
octal digits (see conversion tables below):
B7F
=B7F
= 1011 0111 1111
= 101 101 111 111
= 55778
(1000)/8 125 0
(125)/8 15 5
(15)/8 1 7
(1)/8 0 1
=17508
100010 To X16
(1000)/16 62 8
(62)/16 3 14
(3)/16 0 3
=3E816
=11010102
Convert every 4 binary digits (from bit0) to hex digit as;
1101010
= 110 1010
=6A
= 6A16
30. Convert the decimal number 512 to binary and octal.
Divide by the base 2 to get the digits from the remainders:
Division Quotient Remainder
by 2
(Digit)
(512)/2 256 0
(256)/2 128 0
(128)/2 64 0
(64)/2 32 0
(32)/2 16 0
(16)/2 8 0
(8)/2 4 0
(4)/2 2 0
(2)/2 1 0
(1)/2 0 1
= 10000000002
= 10002
The largest decimal value you can represent with 8 bits in binary is 255.
This is because with 8 bits, the maximum binary number is 11111111, and when converted
to decimal:
111111112=1×27+1×26+1×25+1×24+1×23+1×22+1×21+1×2011111111_2 = 1 \times
2^7 + 1 \times 2^6 + 1 \times 2^5 + 1 \times 2^4 + 1 \times 2^3 + 1 \times 2^2 + 1 \times
2^1 + 1 \times 2^0111111112=1×27+1×26+1×25+1×24+1×23+1×22+1×21+1×20
=128+64+32+16+8+4+2+1=255= 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 =
255=128+64+32+16+8+4+2+1=255
So, the largest value is 255.
A hexadecimal digit can represent 16 unique values (0-9 and A-F, i.e., 0 to 15 in decimal).
Since there are 4 hexadecimal digits, the total number of unique values is calculated by
raising 16 to the power of 4:
164=6553616^4 = 65536164=65536
Thus, 4 hexadecimal digits can represent 65,536 unique values.
g6=b7⊕b6=1⊕0=1
g5=b6⊕b5=0⊕1=1
g4=b5⊕b4=1⊕0=1
g3=b4⊕b3=0⊕1=1
g2=b3⊕b2=1⊕0=1
g1=b2⊕b1=0⊕1=1
g0=b1⊕b0=1⊕0=1
38. Convert the signed binary number 11101011₂ (using 8-bit 2’s
complement notation) to decimal.
Steps:
Number in Binary = 11101011Selected Bits = 08Binary Number after
completing bits = 1110 1011
Step 1:
Taking One's complement of binary number:
Write down the binary Number
1 1 1 0 1 0 1 1
Invert all values (Swap each 0 with 1 and each 1 with 0):
1 1 1 0 1 0 1 1
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
0 0 0 1 0 1 0 0
Step 2:
Taking Two's complement by adding 1 in the previous binary number:
0 0 0 1 0 1 0 0
+ 1
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
0 0 0 1 0 1 0 1
Decimal -21
41. Explain the difference between the binary number system and
the hexadecimal number system in terms of base and digits used.
The binary number system and the hexadecimal number system differ in terms of
their base and the digits used:
1. Binary Number System:
o Base: 2
o Digits Used: The binary system uses only two digits: 0 and 1.
2. Hexadecimal Number System:
o Base: 16
o Digits Used: The hexadecimal system uses sixteen digits. The digits 0 to 9 are the
same as in the decimal system, and the additional digits are represented by the
letters A to F, where:
▪ A = 10
▪ B = 11
▪ C = 12
▪ D = 13
▪ E = 14
▪ F = 15