midterm

# midterm - University of California San Diego Department of...

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

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.

Unformatted text preview: University of California San Diego Department of Electrical and Computer Engineering ECE15 Midterm Exam Tuesday, November 4, 2008 3:30 p.m. — 4:50 p.m. Room 122, Pepper Canyon Hall Name Student ID Number Signature INSTRUCTIONS The exam consists of four problems worth a total of 100 points. There will also be an extra-credit of 5 points for answering all the questions in Problem 2 correctly, and an extra-credit of 10 points for answering all the ques- tions in Problem 3 correctly. Note that a score of 100 points is sufficient to receive the full 20% credit given to the midterm exam. Scores in excess of 100 points will compensate for the final exam and/or lab scores. Write your answers in the spaces provided. If you need extra space, please use the back of the previous page. Partial credit will be given only for substantial progress. Good luck! Grading 1. 12 points 2. 20 points extra credit 3. 38 points extra credit 4. 30 points TOTAL Problem 1 (12 points) Consider the following C program. The program contains numerous errors, which you will be asked to correct. Nevertheless, it is easy to figure out what the program is supposed to do. int main(); double input // user input double result; /* result of the computation scanf("%lf", input); result == (input>0) ? input*input :-1*input*input; printf("The resut of the program is %d n", resut); return 0; a. Briefly explain in your own words what this program is supposed to do. Use at most a couple of sentences to do so. b. Correct all the errors in the program, directly in the box below. You do not need to provide an explanation for the corrections. However, you do need to make sure that the corrected program will compile successfully (under any ANSI C compliant compiler), run without runtime errors, and do what you said it is supposed to do in part ( a )....
View Full Document

{[ snackBarMessage ]}

### Page1 / 9

midterm - University of California San Diego Department of...

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

View Full Document
Ask a homework question - tutors are online