Solutions to Sample Exercises for Quiz 1

Number Conversions, Signed Integer Representations, and Binary Addition

How does one decorate a 31-year-old's birthday cake with only five candles?

	31 = 111112

Perform the following number system conversions:

	11010112 = 10710         F3A516 = 6237310
	1740038 = 6349110        AB3D16 = 4383710
	101101112 = 18310        71568 = 369410


Perform the following number system conversions:

	11010112 = 6B16          1740038 = 1111 1000 0000 00112
	101101112 = B716         F3A516 = 1111 0011 1010 01012
	110110012 = 3318         AB3D16 = 1010 1011 0011 11012


Perform the following number system conversions:

	12510 = 0111 11012       348910 = 66418
	20910 = 1101 00012       971410 = 227628
	13210 = 1000 01002       2385110 = 5D2B16
	5719010 = DF6616         143510 = 26338
	6511310 = FE5916


Add the following pairs of binary numbers, showing all carries:

Carries: 1 100010       1 011000       1 11111110      1 1000000      

           110101         101110         11011101        1110010
           +11001        +100101         +1100011       +1101101
           ------         ------         --------        -------
           001110         010011         01000000        1011111


Give the 8-bit signed-magnitude, one's-complement, two's-complement, and
BCD representation for each of the following decimal numbers:

decimal:       18        115         79        -49        -3        -100
sign-mag:  0001 0010  0111 0011  0100 1111  1011 0001  1000 0011  1110 0100
1's-comp:  0001 0010  0111 0011  0100 1111  1100 1110  1111 1100  1001 1011
2's-comp:  0001 0010  0111 0011  0100 1111  1100 1111  1111 1101  1001 1100

BCD:       0001 1000             0111 1001             1101 0011  
                   0001 0001 0101        1101 0100 1001     1101 0001 0000 0000
(assuming '-' is 1101 as per the textbook)


Fill in the ICC (Integer Condition Code) bits for the following 8-bit
two's-complement additions [NZVC bits]:

        11010110        10111001        01011101        00100110
       +10101001       +11010110       +00100001       +01011010
       ---------       ---------       ---------       ---------
        01111111        10001111        01111110        10000000

       N  Z  V  C      N  Z  V  C      N  Z  V  C      N  Z  V  C
       ----------      ----------      ----------      ----------
       0  0  1  1      1  0  0  1      0  0  0  0      1  0  1  0


What do each of the Condition Code bits mean?  
What does it mean if the bit is a 0?
What does it mean if the bit is a 1?

	N = Negative bit
	    0 = result not negative
	    1 = result is negative

	Z = Zero bit
	    0 = result not equal to the value zero
	    1 = result is equal to the value zero

	V = Overflow bit
	    0 = operation did not cause an overflow (result valid)
	    1 = operation did cause an overflow (result not valid)

	C = Carry bit
	    0 = operation did not produce a carry out
	    1 = operation did produce a carry out


Why do HFC, IBM, and TWA come before Haag, Iacocca, and Taaffe,
respectively, in the phone book?

They are sorted by ordinal values of their ASCII characters.  Check the
ASCII character chart.  Uppercase characters come before lowercase
characters.