Solution Midterm 3

Solution Midterm 3 - Sample Solution to the Jan-Apr 2006...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Sample Solution to the Jan-Apr 2006 Midterm 1. b 2. d /* my Sept-Dec/07 students haven’t covered FOR loops yet */ 3. e 4. c 5. c 6. All answers were acceptable. I wish I could find my list of answers that some students provided for option (c). 7. speed = sqrt(UNIV_GRAV * MASS_EARTH / radius); 8. double density(double mass, double volume); 9. #include <stdlib.h> /* missing, at the top */ int num_data_points = 0; /* 2 errors: Use 0 not 1, and variable name misspelled*/ double average; /* declaration was missing */ The closing */ was missing in the “while” loop comment while ( (fscanf(sensor, “%lf”, &seconds)) == 1 ) /* there were 2 errors in this line */ if (num_data_points == 0) /* equality operator */ /* missing braces around the FALSE block of the last “if” statement */ average = sum / num_data_points; /* was reciprocal */ NOTE: We also deducted marks for newly created errors, and for “non-errors”. errors, and for “non-errors”....
View Full Document

This note was uploaded on 02/02/2010 for the course APSC APSC 260 taught by Professor Jeremyhiliker during the Fall '09 term at UBC.

Page1 / 3

Solution Midterm 3 - Sample Solution to the Jan-Apr 2006...

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

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