Practice Problems on Arithmetic

Problems

1. Convert the following binary numbers to their decimal
   representations:

   (a)  11

   (b)  1101

   (c)  111011

   (d)  0101

2. Convert the following hexadecimal numbers to their    
   decimal representations:

   (a)  11

   (b)  A1

   (c)  CEF

   (d)  BA9

3. Convert the following decimal numbers to their   
   hexadecimal and binary representations:

   (a)  11
          
   (b)  4000

   (c)  42

   (d)  4095

4. Do the binary arithmetic:

   (a)  10110 + 01101

   (b)  11001 + 00101

   (c)  10110 - 01101

   (d)  11111 - 01011

5. Do the hexadecimal arithmetic:

   (a)  82CD + 1982

   (b)  E2C + A31

   (c)  FB28 - 3254

   (d)  E2C - A31

6. The integers in the following computations are indicated 
   in hexadecimal, but represent 32-bit two's complement binary numbers. 
   Perform the operations and indicate if overflow occurs and why. (If 
   overflow occurs the result is invalid, but show it anyway.)

          (a)   BBCA270C         (b)   E3BA265F         (c)   E9B20F5D
              + AE223464             + E045B9A9             - FE605C8D  
              ----------             ----------             ----------


          (d)   5FCA5243         (e)   80000000         (f)   6D4AFBC0
              - AE223464             + 7FFFFFFF             - F89ABCDE
              ----------             ----------             ----------


7. Assume that:

        R0 contains 0007F144
        R1 contains 00000028
        R7 contains EC088840 

   Here are some expressions which may be D(X,B) addresses. If they 
   are valid, calculate the values, and if they are not valid, explain 
   why not:

     (a) 56(,1)

     (b) 0(0,1,7)

     (c) 1(7,0)

     (d) 11(1,7)


Solutions

1. (a)  3

   (b)  13

   (c)  59

   (d)  5

2. (a)  17

   (b)  161

   (c)  3311

   (d)  2985

3. (a)  B (hex) and 1011 (binary)

   (b)  FA0 (hex) and 1111 1010 0000 (binary)

   (c)  2A (hex) and 10 1010 (binary)

   (d)  FFF (hex) and 1111 1111 1111 (binary)

4. (a)  100011

   (b)  11110

   (c)  1001

   (d)  10100

5. (a)  9C4F

   (b)  185D 

   (c)  C8D4

   (d)  3FB

6. (a)  69EC5B70  overflow

   (b)  C3FFE008

   (c)  EB51B2D0

   (d)  B1A81DDF  overflow

   (e)  FFFFFFFF

   (f)  74B03EE2

7. (a)  00000060

   (b)  not valid

   (c)  EC088841

   (d)  EC088873