This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: file:///C|/Documents%20and%20Settings/Jason%20Raftery/My%20Do...2061C%20-%20Spring%201996%20-%20Fateman%20-%20Midterm%201.htm CS61c Midterm Spring 96 Question 1 (2 points): Subtract 0x001f from 0xfff7, interpreting each as a 2's complement 16-bit integer. Express the answer in decimal and hexadecimal. Show your work. Question 2 (2 points): Two lab partners Harry and David are arguing. Harry says "All integers greater than 0 exactly divisible by 6 have exactly 2 1's in their binary representation." David disagrees. He says, "No, but all such numbers have an even number of 1's in their representation." Do you agree with Harry or David, or neither? (Why). Question 3 (4 points): The instruction sllv $8, $9, $10 uses the value in register 10 as the shift amount. Actually, it uses only the least significant 5 bits. Why doesn't it use ALL the bits? Another way of doing the same SLLV would be to do the mysterious: lw $8, shifter # first instruction and $8, mask # where mask is 0xfffff83f andi $10, 0x1f sll $10, $10, 6 or $8, $8, $10 # fifth instruction sw $8, shifter # last instruction shifter: sll $8, $9, 0 In particular, What part of the word is masked out by the first AND instruction?...
View Full Document
This note was uploaded on 09/26/2009 for the course CS 61CL taught by Professor Clancy during the Fall '08 term at Berkeley.
- Fall '08
- Computer Science