{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

midterm-1a-solutions(1)

# midterm-1a-solutions(1) - CSE 110 Midterm Exam 1 Form A...

This preview shows pages 1–4. Sign up to view the full content.

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

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
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 32-bit floating point representation and convert the result into hex- adecimal notation. Remember that 32-bit representation has 1 sign bit, an 8-bit exponent (with a bias of 127), and a 23-bit mantissa field. You must show your work in order to receive partial (or any) credit.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 8

midterm-1a-solutions(1) - CSE 110 Midterm Exam 1 Form A...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online