midterm-1a-solutions

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

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 8 4 6 5 6 6 12 7 6 8 6 9 6 10 6 11 6 12 8 13 6 14 6 15 6 16 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. (8 points) The SBU 2006 CPU contains a ﬁve-stage pipeline: Fetch, Decode, Execute, Store, and Writeback. A single instruction can pass through a single pipeline stage in one clock cycle. Calculate the number of clock cycles required to completely process a sequence of 5 instruc-

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.

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.

Page1 / 8

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

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

View Full Document
Ask a homework question - tutors are online