This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CSE 110 Midterm Exam 1 Form B Fall 2010 ANSWER KEY NAME (please print legibly): Your University ID Number: NO BS bonus: If you do not know the answer to a problem and leave it blank you will receive 1 point for each part (e.g., a,b,c, etc.) that you leave blank. If you write anything in the space and it is wrong, you will receive a 0. You will not lose any points for small coding details or occasional misspellings. QUESTION VALUE SCORE 1 6 2 6 3 14 4 6 5 12 6 6 7 6 8 6 9 6 10 6 11 8 12 6 13 6 14 6 15 10 TOTAL 110 1 1. (6 points) What output is produced by the following code fragment? NOTE: indentation may be misleading! int limit = 100; int num1 = 20; int num2 = 20; if (limit <= limit) { if (num1 == num2) System.out.print("lemon "); System.out.print("lime "); } System.out.println("grape"); (a) lemon lime grape (b) grape (c) lime grape (d) lemon lime ANSWER: A 2. (6 points) The hexadecimal value 92 represents a twos complement binary value. Translate this value into base 10. You must show your work in order to receive any credit for this problem. 92 = 1001 0010 = 10010010 = 128 + 16 + 2 = 110 (Assign 3 points if the student translates the value as unsigned binary instead, getting 146 or 146 as an answer) 2 3. (14 points) Translate 100.5 into 32bit floating point representation and convert the result into hexadec imal notation. Remember that 32bit representation has 1 sign bit, an 8bit exponent (with a bias of 127), and a 23bit mantissa field. You must show your work in order to receive partial (or any) credit....
View
Full
Document
This note was uploaded on 09/14/2011 for the course CSE 110 taught by Professor Shaunakpawagi during the Spring '08 term at SUNY Stony Brook.
 Spring '08
 SHAUNAKPAWAGI
 Computer Science

Click to edit the document details