Professional Documents
Culture Documents
CS130
Assignment-01
Answer:
Question:02
1. Convert the binary number 110101 to:
Octal
Decimal
Hexadecimal
Answer:
Octal:
1. make: 110 101.
1. Convert to octal: 1102=4×1+2×1+1×0=68, 1012
=4×1+2×0+1×1=58.
2. Result: 1101012=658
Decimal:
1. Calculate: 1×25+1×24+0×23+1×22+0×21+1×20.
2. Sum: 32+16+4+1=5332+16+4+1=53.
3. Result: 1101012=53.
Hexadecimal:
1. Make a pair of 4: 0011 0101.
2. Convert to hexadecimal: 00112=0×23+0×22+1×21+1×20 =316 ,
01012=0×23+1×22+0×21+1×20=516.
3. Result: 1101012=3516
------------------------------------------------------------------------------------------------
Answer:
Binary
Convert each octal digit to a 3-digit binary number.
5 in binary is 101.
4 in binary is 100.
7 in binary is 111.
547 in octal is 101 100 111 in binary.
Decimal
Calculate 5×82+4×81+7×80.
320 + 32 + 7 = 359.
547 in octal is 359 in decimal.
Hexadecimal
Convert 547 from octal to binary to hexadecimal (101 100 111).
Group the binary into pairs of four (from the right): 1 0110 0111.
Convert binary to hexadecimal: 1=1, 0110=6, 0111=7.
547 in octal is 167 in hexadecimal.
------------------------------------------------------------------------------------------------
Binary
253÷2=126, remainder 1
126÷2=63, remainder 0
63÷2=31, remainder 1
31÷2=15, remainder 1
15÷2=7, remainder 1
7÷2=3, remainder 1
3÷2=1, remainder 1
1÷2=0, remainder 1
we get 11111101 in binary.
Octal
253÷8=31, remainder 5
31÷8=3, remainder 7
3÷8=0, remainder 3
253 in decimal is 375 in octal.
Hexadecimal
253÷16=15, remainder 13(D in hexadecimal)
15÷16=0, remainder 15(F in hexadecimal)
253 in decimal is FD in hexadecimal.
Answer:
Binary:
To convert from hexadecimal to binary, we convert each hexadecimal
digit to its 4-bit binary representation.
A in hexadecimal = 1010 in binary
B in hexadecimal = 1011 in binary
2 in hexadecimal = 0010 in binary
we get 101010110010 in binary.
Octal:
The binary representation of AB2 is 101010110010.
Splitting into groups of 3 from the right: 1 010 101 100 10
Converting each group to octal:
1 = 1 in octal
010 (binary) = 2 in octal
101 (binary) = 5 in octal
100 (binary) = 4 in octal
10 (binary) = 2 in octal
we get 12542 in octal.
Decimal:
------------------------------------------------------------------------------------------------
Answer:
Octal:
Make pair of three: 101 110 10.
Convert to octal:
1012=4×1+2×0+1×1=58,
1102=4×1+2×1+1×0=68
102=4×0+2×1+1×0=28
Result: 10111010=5628
Decimal
Calculate: =1×27+0×26+1×25+1×24+1×23+0×22 +1×21 +0×20.
=128+0+32+16+8+0+2+0
=186
Result: 10111010=186.
Hexadecimal
Make a pair of 4: 1011 1010.
Convert to hexadecimal: 1011=1×23+0×22+1×21+1×20 =1116 =B,
10102=1×23+0×22+1×21+0×20=1016 = A.
Result: 1011 10102=AB16
------------------------------------------------------------------------------------------------
Answer:
Binary
6 in octal = 110 in binary
7 in octal = 111 in binary
5 in octal = 101 in binary
we get 110111101 in binary.
Decimal
6758= (6×82) + (7×81) + (5×80)
= (6×64) + (7×8) + (5×1)
= (6×64) + (7×8) + (5×1)
=384+56+5
=445
So, 675 in octal is 445 in decimal.
Hexadecimal
We split the binary number into groups of 4 bits from right to left:
110 111 101.
Now, let's convert each group to its hexadecimal equivalent:
110 in binary is 6 in hexadecimal.
111 in binary is 7 in hexadecimal.
101 in binary is 5 in hexadecimal.
So, the hexadecimal representation is 675.
------------------------------------------------------------------------------------------------
7. Convert the decimal number 589 to:
Binary
Octal
Hexadecimal
Answer:
Binary
589÷2=294, remainder 1 294÷2=147, remainder 0
294÷2=147, remainder 0 147÷2=73, remainder 1 147÷2=73, remainder 1
73÷2=36, remainder 1 73÷2=36, remainder 1
36÷2=18, remainder 036÷2=18, remainder 0 18÷2=9, remainder 0
9÷2=4, remainder 1
4÷2=2, remainder 0
2÷2=1, remainder 0
1÷2=0, remainder 1
we get 1001001101 in binary.
Octal
589÷8=73, remainder 5
73÷8=9, remainder 1
9÷8=1, remainder 1
1÷8=0, remainder 1
we get 1125 in octal.
Hexadecimal
589÷16=36, remainder 13(D in hexadecimal) 36÷16=2, remainder 4
2÷16=0, remainder 2
we get 24D in hexadecimal.
------------------------------------------------------------------------------------------------
Decimal:
Decimal:
111001012=(1×27)+(1×26)+(1×25)+(0×24)+(0×23)+(1×22)+(0×21)+(1×2
0
)
=128+64+32+0+0+4+0+1
=229
11100101 in binary is 229 in decimal.
Hexadecimal:
The binary number 11100101 can be grouped as 1110 0101.
Converting each group to hexadecimal:
1110 in binary = E in hexadecimal
0101 in binary = 5 in hexadecimal
we get E5 in hexadecimal.
------------------------------------------------------------------------------------------------
Hexadecimal:
From the first step, we have the binary as 111111111.
Now, convert binary to hexadecimal:
Split into 4-bit groups from right to left: 111 111 111
Convert each group to its hexadecimal equivalent:
111 (binary) = 7 (hexadecimal)
So, the hexadecimal representation is 777.