ecs30_F2008_1st_midterm_key

ecs30_F2008_1st_midterm_key - ecs30b 1st Midterm Exam. Fall...

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

View Full Document Right Arrow Icon
ecs30b – 1 st Midterm Exam. Fall 2008 – October 17, 2008 ECS-30b, Fall 2008, 1 st Midterm Exam Key Name: __________________________ Student ID: __________________________ E-mail: __________________________ Important Instructions: close book/notes. We have totally 10 questions (two points for each, totally 20%). 10 pages Please write precise and clean answers. If you write down the steps regarding how you obtain the final answer, I might give you partial credits even the final answer itself is wrong. Please write clearly to let the instructor recognize/understand your hand writing. Every page of this exam book needs to be returned. Also, while turning in your exam book, please make sure to SIGN the special sign-up sheet. If you do NOT sign up and in case we lose your exam book, it will be hard to convince us that you actually turn in the exam book back to us. If we suspect any cheating behavior, we will pass the case to the academic committee immediately. -1/10-
Background image of page 1

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

View Full DocumentRight Arrow Icon
ecs30b – 1 st Midterm Exam. Fall 2008 – October 17, 2008 Q-01 Question/Answer (2%) (Different Options/Phases in gcc, the GNU C Compiler) Please describe the differences between the following two command lines. (Hint: please describe which file will be produced by which line and why.) 1. % gcc –c ecs30b_hw1.c 2. % gcc ecs30b_hw1.c 1. compiling only (ecs30b_hw1.o) 2. Q-02 Question/Answer: (2%) (Finding C Syntax Errors) Please identify/correct 4 syntax ERRORS (not warnings) from the following pieces of code. (Hint: there are about 6~7 errors, but you only need to identify 4 of them to get the full credits for this question.) Please circle the errors and write down the fixes. 01 #inc 1 ude <stdio.h> 02 #define KMS_PER_MILE 1.609 03 int 04 main(void) 05 [ 06 double miles ”missing ; 07 double kms; 08 print ”? f ("Enter the distance in miles> ? ); 09 ? ) ; 10 kms = KMS_PER_MILE * miles; 11 printf("That equals %f kilometers.\n", KMS ); 12 return 0; 13 } -2/10-
Background image of page 2
ecs30b – 1 st Midterm Exam. Fall 2008 – October 17, 2008
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

ecs30_F2008_1st_midterm_key - ecs30b 1st Midterm Exam. Fall...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online