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: a) 1101 & 1110 b) 1011  1001 c) 1001 ^ 1011 d) 1011 >> 2 e) ~0110 8. Each operation is written in Java or C, whichever you know. The variables are all integers. Rewrite the line to use a bitwise operation. a) x * 2 b) y / 64 c) z % 16 Errors Given your new knowledge of binary representation and limited bit width, answer the following questions. 9. What happens when the result of an addition or subtraction does not fit into the number of bits provided? 8. What would happen if you executed the following code: Note: unsigned int means an integer being interpreted with unsigned numbers, as we learned at the beginning with binary. Java does not have such a type, but C does. void countdown(int x) { printf("Countdown: "); for(unsigned int i=x;i>=0;i++) printf("%d, ",i); printf(". ... Blastoff!"); }...
View
Full
Document
This note was uploaded on 12/27/2011 for the course CMPSC 30 taught by Professor Franklin during the Fall '09 term at UCSB.
 Fall '09
 FRANKLIN

Click to edit the document details