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

Exercises Ch3

Uploaded by

alyah.alshehri
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)
21 views

Exercises Ch3

Uploaded by

alyah.alshehri
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/ 4

Exercises:

Converting Binary to Decimal

(111001)2 = (1×25 )+(1×24)+(1×23)+(0×22)+(0×21)+(1×20 )


=32+16+8+1= 5710
binary number: 1 1 1 0 0 1

power of 2: 32 16 8 4 2 1

power of 2: 25 24 23 22 21 20

(1101001)₂ = (1 × 2⁶) + (1 × 2⁵) + (0 × 2⁴) + (1 × 2³) + (0 × 2²) + (0 × 2¹) + (1 × 2⁰)

= 64 + 32 + 0 + 8 + 0 + 0 + 1= (105)₁₀

binary number: 1 1 0 1 0 0 1

power of 2: 64 32 16 8 4 2 1

power of 2: 26 25 24 23 22 21 20

(11110111)₂ = (1 × 2⁷) + (1 × 2⁶) + (1 × 2⁵) + (1 × 2⁴) + (0 × 2³) + (1 × 2²) + (1 × 2¹) +


(1 × 2⁰)

= 128 + 64 + 32 + 16 + 0 + 4 + 2 + 1= (247)₁₀

binary number: 1 1 1 1 0 1 1 1

power of 2: 128 64 32 16 8 4 2 1

power of 2: 27 26 25 24 23 22 21 20
Convert Unsigned Decimal to Binary:

(𝟏𝟐𝟎)₁₀ =

Division Quotient Reminder


120/2 60 0
60/2 30 0 (𝟏𝟐𝟎)₁₀ = (𝟏𝟏𝟏𝟏𝟎𝟎𝟎)₂
30/2 15 0
15/2 7 1
7/2 3 1
3/2 1 1
1/2 0 1
(𝟓𝟓)₁₀ =

Division Quotient Reminder


55/2 27 1
27/2 13 1 (𝟓𝟓)₁₀ = (𝟏𝟏𝟎𝟏𝟏𝟏)₂
13/2 6 1
6/2 3 0
3/2 1 1
1/2 0 1

Convert the 16-bit binary number to hexadecimal.

(1101 1111 1001 0110)₂

=(D F 9 6)₁₆

Converting Hexadecimal to Decimal

(3B1E)16

=3×16³ +11×16²+1×161+14×160 =

Converting Decimal to Hexadecimal

(479)10

(𝟒𝟕𝟗)₁₀ = (𝟏𝐃𝐅)₁₆
Division Quotient Reminder
479/16 29.9375 16x.9375=15=F
29/16 1.8125 16x.8125=13=D
1/16 0.0625 16x0.0625=1
What is the largest 10-bit unsigned integer?

210 – 1 = 1023
Hexadecimal Addition:

(𝟑𝐀𝟖𝟐𝟔𝟑)₁₆ + (𝟕𝐃𝐂𝟔𝟗𝟖)₁₆=

1 1
3 A 8 2 6 3 (𝟑𝐀𝟖𝟐𝟔𝟑)₁₆ + (𝟕𝐃𝐂𝟔𝟗𝟖)₁₆ = (𝐁𝟖𝟒𝟖𝐅𝐁)₁₆
+
7 D C 6 9 8

B 8 4 8 F B

3+8=11=B

6+9=15=F

2+6=8

8+C=8+12=20 ≥16=20-16=4 carry 1

A+D=1+10+13=24≥16=24-16=8 carry 1

1+3+7=11=B

Hexadecimal Subtraction:

(𝟕𝟗𝐀𝐃)₁₆ − (𝟓𝐀𝟖𝐅)₁₆=
6 9
7 9 A D
- (𝟕𝟗𝐀𝐃)₁₆ − (𝟓𝐀𝟖𝐅)₁₆ = (𝟏𝐅𝟏𝐄)₁₆
5 A 8 F

1 F 1 E

D-F=13-15(cannot so I will add 16 to D ) =(16+13)=29

29-15=14=E

9-8=1

9-A=9-10(cannot so I will add 16 to 9 ) =(16+9)=25

25-10=15=F

6-5=1
Binary subtraction:

(𝟏𝟎𝟏𝟎𝟎𝟏𝟏)₂ − (𝟎𝟏𝟏𝟏𝟎𝟎)₂ =
1 2 1
0 2 0 2 2
1 0 1 0 0 1 1 (𝟏𝟎𝟏𝟎𝟎𝟏𝟏)₂ − (𝟎𝟏𝟏𝟏𝟎𝟎) = (𝟎𝟏𝟏𝟎𝟏𝟏𝟏)₂
-
0 1 1 1 0 0

0 1 1 0 1 1 1

What is the range of signed values that may be stored in 10 bits?

-2n–1 to (2n–1 – 1)

-210–1 to (210–1 – 1)=

Positive range: 0 to 29–1 – 1

Negative range: -29–1 to -1

You might also like