CMU 15-110 Fall 2018: Principles of Computing
Quiz1 Practice (Due never)



  1. Represent 21 as an 8-bit unsigned binary number

    Answer:
    21 = 16 + 4 + 1 = 00010101
    

  2. Represent -9 as a 6-bit signed binary number using sign-magnitude

    Answer:
    +9 = 8 + 1 = 001001, so -9 = 101001 in sign-magnitude
    

  3. Represent the string 'CbA' to decimal numbers using zero-termination. Hint: here are some ascii values: 'A' is 65, 'a' is 97, and '0' is 48

    Answer:
    67, 98, 65, 0
    

  4. Represent the string 'B1' to decimal numbers using prefix-encoding Hint: here are some ascii values: 'A' is 65, 'a' is 97, and '0' is 48

    Answer:
    2, 66, 49
    

  5. Represent the float 103.3001 using the mantissa,exponent representation from class

    Answer:
    1033001, 4
    

  6. What is the largest unsigned int that can be represented in 4 bits? Give your answer in base 10

    Answer:
    1111 = 8 + 4 + 2 + 1= 15
    

  7. Show the work to compute 213 - 104 using 10's complement:

    Answer:
      104 -> 895 + 1 -> 896  (so 896 equals -104 in 10's complement)
      So: 213 - 104 = 213 + 896 (if we ignore the last carry) = 109.
      Note: For any credit, your work would have to include both 896 and 109.
    

  8. Show the work to compute 64 * 17 using lattice multiplication

    Answer:


  9. Show all 5 additions (always only adding only two numbers) used to compute 17 * 13 using egyptian multiplication:

    Answer:
     17 + 17 = 34 (2 17's)
     34 + 34 = 68 (4 17's)
     68 + 68 = 136 (8 17's)
     ---------
    Now we note that 13 = 8 + 4 + 1, so:
     ----------
     17 + 68 = 85 (1 17 + 4 17's -> 5 17's)
     85 + 136 = 221 (5 17's + 8 17's -> 13 17's)
    

  10. Say we started with this image from the Parity Card Trick website:

    Fill in the bottom row and right column as required by the trick.

    Answer:


  11. Say we saw this image from the Parity Card Trick website, after we set up the board properly and after a bit was flipped:

    Which bit was flipped, in (row, col) notation, where we start counting at 0 not 1 (so the top row is row 0, and the left column is col 0)?

    Answer:
    (1, 3)
    

  12. Explain in 5 words or less how to always win at Nim.

    Answer:
    seek multiples of 4
    

  13. Who were our guest speakers in week1, and in 10 words or less, what is one technical topic they talked about?

    Answer:
    Manuel and Lenore Blum, the BBS pseudo-random number generator
    Note: it has to be a reasonable answer, and technical.  So while
    Lenore did talk about Venezuela, and it was really interesting,
    that still would not get credit here.
    
That's it! Nothing else will appear on quiz1.