G- Written Questions- Solutions and RubricExam 1

G- Written Questions- Solutions and RubricExam 1 -...

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

14:440:127, Fall 2008 Exam 1 Version G “No Computer” Question 1: Answer whether the following questions evaluate to True or False : Let x = 15, y = 93, and z = -5 a) z+5 > 0 FALSE (exactly 0) b) rem(y,x) > 3 FALSE (exactly 3) c) ~z FALSE d) y - 2*x > 100 | x<14 FALSE e) ~ ( round(15.9) – fix(15.9) ) FALSE f) ceil(y/x) == 6 FALSE (7) g) x ~= x | ( (y/z) > (x/z) ) FALSE Subtract 1 point for each incorrect answer. No partial credit is given for this question. “No Computer” Question 2: Identify the two errors in the following code segment (you can rewrite the incorrect statement in your blue book and circle what’s wrong). Then, rewrite the code so that it will run correctly. fprintf(‘here is a number: %f and here is a word: ‘%s’. Goodbye ’, ‘flower’, 52) ERROR 1: '%s' should be ''%s'' (two single quotes on each side) ERROR 2: flower should either be ‘flower’, or you needed to define the variable flower fprintf('here is a number: %f and here is a word: ''%s''. Goodbye ’, 52, 'flower') OR

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 / 3

G- Written Questions- Solutions and RubricExam 1 -...

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

View Full Document
Ask a homework question - tutors are online