0% found this document useful (0 votes)
43 views

Assignment Four 1

computer assignments

Uploaded by

oyamoopondo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Assignment Four 1

computer assignments

Uploaded by

oyamoopondo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

KISII UNIVERSITY

NAME: STEPHEN NYIENDO

REG NO: AS31/00243/24

UNIT NAME: INTRODUCTION COMPUTER APPLICATION

UNIT CODE: COMP 101

ASSIGNMENT FOUR

NUMBER SYSTEMS AND BASE CONVERSIONS

DEADLINE FOR SUBMISSION : (24/10/2024)


Basic Number Systems (Decimal, Binary, Octal, Hexadecimal)
1. Convert the binary number 110101₂ to decimal.
(110101)₂ = (1 × 2⁵) + (1 × 2⁴) + (0 × 2³) + (1 × 2²) + (0 × 2¹) + (1 × 2⁰) =
(53)₁₀
=5310
2. Convert the decimal number 157 to binary.
Dividend Remainder
157/2 = 78 1
78/2 = 39 0
39/2 = 19 1
19/2 = 9 1
9/2 = 4 1
4/2 = 2 0
2/2 = 1 0
1/2 = 0 1

=100111012
3. Convert the hexadecimal number 3F4A₁₆ to decimal.

(3F4A)₁₆ = (3 × 16³) + (15 × 16²) + (4 × 16¹) + (10 × 16⁰) = (16202)₁₀


=1620210
4. Convert the octal number 725₈ to decimal.

725 = (7 × 8²) + (2 × 8¹) + (5 × 8⁰) = 469


=46910
5. Convert the decimal number 255 to hexadecimal.

Division Quotient Remainder Digit


by 16 (Digit)
(255)/16 15 15 0
(15)/16 0 15 1

= FF16

6. Convert the binary number 10101101₂ to hexadecimal.


We Convert every 4 binary digits (from bit0) to hex digit as;
10101101
= 1010 1101
=AD
= AD16
7. Convert the hexadecimal number A5₁₆ to binary.
We Convert each hex digit to 4 binary digits
A5
=A5
= 1010 0101
= 101001012
8. Convert the octal number 157₈ to binary.

We Convert each octal digit to 3 binary digits;


157
=157
= 1 101 111
= 11011112

9. Convert the binary number 1110100110₂ to octal.


We Convert every 3 binary digits (from bit0) to octal as;
1110100110
= 1 110 100 110
=1646
= 16468

10. Convert the decimal number 456 to octal.

11. Division Quotient Remainder


by 8 (Digit)
(456)/8 57 0
(57)/8 7 1
(7)/8 0 7

=7108
Advanced Base Conversion and Arithmetic

11. Perform binary addition: 1101₂ + 1011₂.


+
1 1 0 1
1 0 1 1
1 1 0 0 0

=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

16. Convert the binary number 1011001101₂ to octal and


hexadecimal.
We Convert every 3 binary digits (from bit0) to octal digit as;
1011001101
= 1 011 001 101
=1315
= 13158
We Convert every 4 binary digits (from bit0) to hex digit as;
1011001101
= 10 1100 1101
=2CD
= 2CD16
17. Perform octal multiplication: 23₈ × 5₈.

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

19. Convert the hexadecimal number B7F₁₆ to binary and octal.


We Convert each hex digit to 4 binary digits as;
B7F
=B7F
= 1011 0111 1111
= 1011011111112

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

20. Convert the binary number 111010011010₂ to decimal and


hexadecimal.
(111010011010)₂ = (1 × 2¹¹) + (1 × 2¹⁰) + (1 × 2⁹) + (0 × 2⁸) + (1 ×
2⁷) + (0 × 2⁶) + (0 × 2⁵) + (1 × 2⁴) + (1 × 2³) + (0 × 2²) + (1 × 2¹) + (0
× 2⁰) = (3738)₁₀
=373810
We Convert every 4 binary digits (from bit0) to hex digit (see
conversion table below):
111010011010
= 1110 1001 1010
=E9A
= E9A16

21. Additional Base Conversion Questions


22. Convert the binary number 10011011101₂ to octal.
We Convert every 3 binary digits (from bit0) to octal digit (see
conversion table below):
10011011101
= 10 011 011 101
=2335
= 23358

23. Convert the octal number 576₈ to hexadecimal.


We Convert every octal digit to 3 binary digits, then convert every 4
binary digits to1 hex digit as;
576
=576
= 101 111 110
= 1 0111 1110
=17E
= 17E16

24. Convert the decimal number 1000 to binary, octal, and


hexadecimal.
100010 To X2
=10002
100010 To X8
Divide by the base 8 to get the digits from the remainders:

Division Quotient Remainder


by 8
(Digit)

(1000)/8 125 0

(125)/8 15 5

(15)/8 1 7

(1)/8 0 1

=17508

100010 To X16

Divide by the base 16 to get the digits from the remainders:

Division Quotient Remainder


by 16
(Digit)

(1000)/16 62 8

(62)/16 3 14

(3)/16 0 3

=3E816

25. Convert the hexadecimal number F2A₁₆ to binary.


We Convert each hex digit to 4 binary digits (see conversion
table below):
F2A
=F2A
= 1111 0010 1010
= 1111001010102

26. Convert the binary number 111101111₁₆ to decimal.

(111101111)₂ = (1 × 2⁸) + (1 × 2⁷) + (1 × 2⁶) + (1 × 2⁵) + (0 × 2⁴) +


(1 × 2³) + (1 × 2²) + (1 × 2¹) + (1 × 2⁰) = (495)₁₀
=49510

27. Convert the octal number 345₈ to binary and hexadecimal.


We Convert each octal digit to 3 binary digits as;
345
=345
= 11 100 101
= 111001012

We Convert every octal digit to 3 binary digits, then convert


every 4 binary digits to1 hex digit as;
345
=345
= 11 100 101
= 1110 0101
=E5
= E516
28. Convert the hexadecimal number 7F4C₁₆ to octal.
We Convert each hex digit to 4 binary digits and then convert
each 3 binary digits to octal digits as;
7F4C
=7F4C
= 111 1111 0100 1100
= 111 111 101 001 100
=77514
= 775148

29. Perform hexadecimal subtraction: F3₁₆ - A9₁₆.


We Convert each hex digit to 4 binary digits as;
F3
=F3
= 1111 0011
= 111100112
We Convert each hex digit to 4 binary digits as;
A9
=A9
= 1010 1001
= 101010012
= 111100112 - 101010012
+
1 1 1 1 0 0 1 1
1 1 0 1 0 0 1
1 1 0 1 0 1 0

=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

Divide by the base 8 to get the digits from the remainders:

Division Quotient Remainder Digit


by 8 (Digit)
(512)/8 64 0 0
(64)/8 8 0 1
(8)/8 1 0 2
(1)/8 0 1 3

= 10002

31. Convert the binary number 110110110011₂ to decimal, octal,


and hexadecimal.
(110110110011)₂ = (1 × 2¹¹) + (1 × 2¹⁰) + (0 × 2⁹) + (1 × 2⁸) + (1 × 2⁷) + (0
× 2⁶) + (1 × 2⁵) + (1 × 2⁴) + (0 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰) =
(3507)₁₀
=350710
We Convert every 3 binary digits (from bit0) to octal digit as;
110110110011
= 110 110 110 011
=6663
= 66638
We Convert every 4 binary digits (from bit0) to hex digit as;
110110110011
= 1101 1011 0011
=DB3
= DB316
32. What is the largest decimal value you can represent with 8 bits
in binary?

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.

33. How many unique values can be represented with 4


hexadecimal digits?

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.

34. What is the binary equivalent of the hexadecimal number FF₁₆?


We Convert each hex digit to 4 binary digits as;
FF
=FF
= 1111 1111
= 111111112
35. What is the result of adding the octal numbers 176₈ and 45₈?
Convert each octal digit to 3 binary digits
176
=176
= 1 111 110
= 11111102

Convert each octal digit to 3 binary digits as;


45
=45
= 100 101
= 1001012

36. Convert the binary number 10101010₂ to Gray code.

Binary code : 10101010

Method-1: (Binary to Gray code)


g7=b7=1

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

∴ Gray code : 11111111


37. What is the 2’s complement of the binary number 1101₂?
Steps:
Number in Binary = 1101Selected Bits = 08Binary Number after
completing bits = 0000 1101
Number in 2's complement with 08-bit represantation
Binary 0000 1101
Decimal 13

2's Complement 1111 0011

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

Number in 2's complement with 08-bit represantation

Binary 1110 1011

Decimal -21

2's Complement 0001 0101


39. Convert the decimal number -45 to its 8-bit binary 2’s
complement form.
To convert the decimal number −45-45−45 into its 8-bit binary 2's complement form,
follow these steps:
Step 1: Convert 45 to binary
First, convert the positive number 454545 to its binary form.
• 45/2=22 remainder 1
• 22/2=11 remainder 0
• 11/2=5 remainder 1
• 5/2=2 remainder 1
• 2/2=1 remainder 0
• 1/2=0 remainder 1
Reading from bottom to top, 4510=101101245_{10} = 101101_24510=1011012.
Step 2: Add leading zeros to make it 8 bits
To represent the number in 8-bit form, add leading zeros to make the binary number 8
bits long: 4510=00101101245_{10} = 00101101_24510=001011012
Step 3: Find the 2's complement
To get the 2's complement of −45-45−45:
1. Invert the digits (flip the bits) of 00101101200101101_2001011012:
001011012→110100102001011012 \rightarrow 11010010_2001011012→110100102
2. Add 1 to the inverted number: 110100102+1=11010011211010010_2 + 1 =
11010011_2110100102+1=110100112
Step 4: Result
The 8-bit binary 2's complement form of −45-45−45 is:
−4510=110100112-45_{10} = 11010011_2
−4510 = 110100112

40. Perform binary division: 110110₂ ÷ 101₂.


Dividend (110110 base 2) = 54
in decimal Divisor (101 base 2) = 5
in decimal Quotient = 1010 (base 2) Remainder = 100 (base 2)

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

You might also like