Download presentation

Presentation is loading. Please wait.

Published byPriscilla Johns Modified about 1 year ago

1
COMPSCI 210 Semester Tutorial 1

2
Binary to Decimal Conversion

3
2.10 Convert the following 2's complement binary numbers to decimal numbers. a)1010 b) c) d)

4
2.10. c --- Solution – sign bit is 1, so this number is negative. – Calculate the 2's complement (flipping the digits above) = -2 (Affix a minus sign in front)

5
2.10. d --- Solution sign bit is 0, so this number is positive. =0*(2^14)+1*(2^13)+1*(2^12)+1*(2^11)+0*(2^10)+0*(2^9)+1*(2^8)+ 1*(2^7)+1*(2^6)+0*(2^5)+1*(2^4)+0*(2^3)+0*(2^2)+1*(2^1)+1*(2^0) = 1*(2^13)+1*(2^12)+1*(2^11)+1*(2^ 8 )+1*(2^ 7 )+1*(2^ 6 )+1*(2^4)+ 1*(2^1)+1*(2^0) = =14803

6
Decimal to Binary Conversion

7
2.11 convert these decimal numbers to 8 bit 2’s complement binary numbers. a)102 b)64 c)33 d)-125 e)127

8
2.11.a --- Solution

9
2.11.d --- Solution -125 Two’s complement: (flipping the digits above) + 1 (adding “1”)

10
Decimal fractions to Binary (0.3125) 10 = (?) 2 * 2 = * 2 = 1.25 0.25 * 2 = 0.5 0.5 * 2 = 1.0 (0.3125) 10 = (0.0101) 2 (0.0101) 2 = (0. 0* * * *2 -4 ) 10 = ( ) 10 = (0.3125) 10

11
2.39 Write IEEE floating point representation of the following decimal numbers? a)3.75 b) c) d)64,000

12
2.39.b --- Solution -( ) 10 = -( ) 2 Normalizing the number – The sign bit is 1, reflecting the fact that the number is a negative number – The exponent: 5 = 132 – 127 =>

13
2.39.d --- Solution (64,000) 10 = ( ) 2 Normalizing the number = – The sign bit is 0, reflecting the fact that the number is a positive number – The exponent is 15 = 142 – 127

14
ASCII Codes ASCII stands for American Standard Code For Information Interchange. – Each key on the keyboard is identified by its unique ASCII code – When you type a key on the keyboard, the corresponding eight-bit code is stored and made available to the computer – Most keys are associated with more than one code, for example, h and H have two different codes

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google