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

Tutorial 1

The document provides examples of converting between different numeric bases, including binary, decimal, octal, and hexadecimal. It gives step-by-step workings for converting decimal numbers to and from other bases, performing arithmetic in different bases, and calculating ones' and twos' complements. Additional examples demonstrated converting between binary and ASCII character codes to represent names.

Uploaded by

Maimonh Almamory
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)
50 views

Tutorial 1

The document provides examples of converting between different numeric bases, including binary, decimal, octal, and hexadecimal. It gives step-by-step workings for converting decimal numbers to and from other bases, performing arithmetic in different bases, and calculating ones' and twos' complements. Additional examples demonstrated converting between binary and ASCII character codes to represent names.

Uploaded by

Maimonh Almamory
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/ 7

1.

Find the decimal value of the following numbers


a) (11011.101)2
b) (432)5
c) (745)8
d) (BCAD.B)16

Solutions
a) (11011.101)2
1 ∗ 24 + 1 ∗ 23 + 0 ∗ 22 + 1 ∗ 21 + 1 ∗ 20 + 1 ∗ 2−1 + 0 ∗ 2−2 + 1 ∗ 2−3
16 + 8 + 0 + 2 + 1 + 0.5 + 0 + 0.125
Answer = 27.625
b) (432) in decimal is
5
4 ∗ 52 + 3 ∗ 51 + 2 ∗ 50
100 + 15 + 2
Answer = 117

c) (745) in decimal is
8
7 ∗ 82 + 4 ∗ 81 + 5 ∗ 80
448 + 32 + 5
Answer = 485

d) (BCAD.B) in decimal is
16
11 ∗ 163 + 12 ∗ 162 + 10 ∗ 161 + 13 ∗ 160 + 11 ∗ 16−1
45056 + 3072 + 160 + 13 + 0.6875
Answer = 48301.6875

2. Find the Octal value of following hexadecimal numbers by first converting to binary
a) (42BC)16
b) (568)16
Solutions
a) Octal value of (42BC)16
Binary value = 0100_0010_1011_1100 = 100_001_010_111_100
Answer = (41274)8

b) Octal value of (568)16


Binary value = 0101_0110_1000 = 010_101_101_000
Answer = (2550)8

1
3. Convert decimals to binary
a) 38.315
b) 262
Solutions:
a) The binary value of 38.315 is
Remainder integer
38/2 = 19 0 0 .315 *2 = .630 0
19/2= 9 1 0.630*2 = 0.26 1
9/2 = 4 1
4/2 =2 0 0.26*2 = 0.52 0
2/2 = 1 0 0.52*2 = 0.04 1
Answer = 100110.0101

b) The binary value of 262


Remainder
262/2 = 131 0
131/2 = 65 1
65/2 = 32 1
32/2 = 16 0
16/2 = 8 0
8/2 = 4 0
4/2=2 0
2/2 = 1 0

Answer = 100000110

4. Find The Octal value of the binary numbers


a) 101011100.011111101
b) 110010101.11101100

Solution:
a) 101_011_100.011_111_101
534.375

a) 110_010_101.111_011_000
625.730

2
5. Find The binary value of the hexadecimal number
a) (408.D)
16
b) (26CD)
16

Solution:
a) Binary value of the hexadecimal number 408.D

(408.D) = 4 0 8 . D
16
0100 0000 1000 . 1101
Answer = 010000001000.1101

b) Binary value of the hexadecimal number 26CD


(26CD) = 2 6 C D
16
0010 0110 1100 1101
Answer = 0010011011001101

6. Find The 9’s complement of the following numbers

a) 25,478,036
b) 63,325,600

Solution
a) The 9’s complement of 25,478,036
[N] = (rn - 1) – (N) 9 9 9 9 9 9 9 9
r-1 r
2 5 4 7 8 0 3 6
(10 - 1) – 25478036
8
7 4 5 2 1 9 6 3
Answer = 74,521,963

b) The 9’s complement of 63,325,600


n
[N] = (r - 1) – (N) 9 9 9 9 9 9 9 9
r-1 r
8 6 3 3 2 5 6 0 0
( 10 - 1) – 63,325,600 3 6 6 7 4 3 9 9

Answer = 36,674,399

3
7. Find The 1’s and 2’s complement of the following numbers
a) 11010010
b) 01110010
Solution:
1’s complement 1 1 1 1 1 1 1 1
1 1 0 1 0 0 1 0
a) 11010010 = 00101101 0 0 1 0 1 1 0 1
1 1 1 1 1 1 1 1
b) 01110010 = 10001101
0 1 1 1 0 0 1 0
1 0 0 0 1 1 0 1

2’s complement
1 1 1 1 1 1 1 1
a) 11010010 = 00101110 1 1 0 1 0 0 1 0
+1
0 0 1 0 1 1 0 1

b) 01110010 = 10001101 1 1 1 1 1 1 1 1
0 1 1 1 0 0 1 0
+1
1 0 0 0 1 1 1 0

8. Perform unsigned 2’s complement subtraction of


(6) -(3)
10 10
Solution

2’s complement subtraction


(6)
Minuend = 10
(3)
Subtrahend = 10
Binary value of minuend = 110
Binary value of subtrahend = 011
2’s complement of subtrahend = 101
Addition: (110) + (101) = 011
(3)
Answer = 011 = 10

4
9. Perform signed subtraction of (6)10 – (9)
Solution: 10 and indicate the sign bit

Signed bit
(6)
10 0 0110
)
- (9 10 1 0111
1 1101

5
Optional explain other coding examples
such as BCD :

example to give 35710 = 0011 0101 0111 (BCD)

ASCII Character Code


Many applications of digital computers require the handling not only of numbers but also of
other characters or symbols, such as the letters of the alphabet. For instance, consider a high-tech
company with thousands of employees. To represent the names and other pertinent information,
it is necessary to formulate a binary code for the letters of the alphabet. In addition, the same
binary code must represent numerals and special characters (such as $). An alphanumeric
character set is a set of elements that includes the 10 decimal digits, the 26 letters of the alphabet,
and a number of special characters. Such a set contains between 36 and 64 elements if only
capital letters are included, or between 64 and 128 elements if both uppercase and lowercase
letters are included. In the first case, we need a binary code of six bits, and in the second, we
need a binary code of seven bits.

6
Decode the following ASCII code:
 1010011 1110100 1100101 1110110 1100101 0100000 1001010 1101111 1100010 1110011
Answer is Steve Jobs

You might also like