This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: y = 4? What is the output if x = 2 and y = 2? (1 point each; 3 points total) if (x > y) { if (y > 2) { int z = x + y; System.out.println(“z is ” + z); } } else System.out.println(“x is ” + x); NOT OR XOR AND A B C D 4. What would be the result of performing a twobit right circular shift on the byte represented in hexadecimal notation as 0D? Give your answer in hexadecimal notation. (2 points) 5. Use a switch statement to rewrite the following if statement (3 points): if (a == 1) x += 5; else if (a == 2) x += 10; else if (a == 3) x += 16; else if (a == 4) x += 34; 6. Extra Credit: Translate the following pattern of 32 bits into a real number (in base 10). You may assume that the Frst bit represents the sign, the next 8 bits represent the (biased) exponent, and the remaining 23 bits represent the mantissa. Use a value of 127 for the bias. (3 points) 1100 0010 0100 1011 0000 0000 0000 0000...
View
Full Document
 Spring '08
 SHAUNAKPAWAGI
 Computer Science, Clock rate, Clock signal, Positional notation, Decimal, Rational number

Click to edit the document details