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 A 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 = 15; int num2 = 40; 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: C 2. (6 points) What is the result (in hexadecimal) of adding the unsigned binary values 111010 and 10111? You must show your work to receive full or partial credit. 111010 + 10111 1010001 = 01010001 = 0101 0001 = 51 (base 16) 1010001 (assign 4 points for basic addition, 1 point for including the carry bit, and 1 point for converting the answer to hexadecimal) 2 3. (14 points) Translate 72.125 into 32bit floating point representation and convert the result into hex adecimal 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