SEMESTER SPRING 2022
CS101
ASSIGNMENT NO. 1
REEM FAROOQ
ID: bc220200597
Alice and Bob are playing a game by encoding their messages in an 8-bit binary. Trudy wants
to understand or modify their messages. You have to help Trudy to convert encoded
messages into a readable format by performing the following operations
a) Convert the above 8-digit binary numbers into decimals.
Answer:
01001000
(0×2⁷)+(1×2⁶)+(0×2⁵)+(0×2⁴)+(1×2³)+(0×2²)+(0×2¹)+(0×2⁰)
= 0+64+0+0+8+0+0+0
= 64+8
=72
= (01101001)² = 72¹⁰
(01101001)²
(0×2⁷)+(1×2⁶)+(1×2⁵)+(0×2⁴)+(1×2³)+(0×2²)+(0×2¹)+(1×2⁰)
= 0+64+32+0+8+0+0+1
=64+32+8
=105
= (01101001)² = 105¹⁰
(00101100)²
(0×2⁷)+(0×2⁶)+(1×2⁵)+(0×2⁴)+(1×2³)+(1×2²)+(0×2¹)+(0×2⁰)
= 0+0+32+0+8+4+0+0
= 32+8+4
= 44
= (00101100)² = 44²
b) Convert the 8-digit binary into hexadecimal.
01001000
By intersect 01001000 in groups:
0100 1000
4 4
01001000² = 4816
01101001
By intersect 01101001 in groups:
0110 1001
6 9
01101001² =6916
00101100
By intersect 00101100 in groups:
0010 1100
2 c
00101100 ² = 2c16
b) Decode the 8-digit binary in textual form.
By using the ASCII table.
Binary 01001000 01101001 00101100
Form
Textual 72 105 44
Form
ASCII H i ,
FORM
Answer in textual form is =Hi,