{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

I- Written Questions- Solutions and RubricExam 1

# I- 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 I “No Computer” Question 1: Answer whether the following Matlab expressions display an answer that’s greater than 0, exactly 0, or less than 0: Let a = 1 :- 1 :- 4; b = 1 : 6; c = linspace(0,5,6); d = 2; e = 15.3; f = 15.5; a) a(d) exactly 0 b) length(b)>length(c) exactly 0 c) sum(b)<sum(a) exactly 0 d) (c(6) > b(6)) & (c(6) > a(6)) exactly 0 e) c(6) > b(6)) | (c(6) > a(6)) greater than 0 f) ( round(e) – fix(e) ) exactly 0 (corrected, sorry!) g) ( round(f) – fix(f) ) greater than 0 Subtract 1 point for each incorrect answer. No partial credit is given for this question. “No Computer” Question 2: Given the variables a = 514.363; and b = ‘Blase’; write an fprintf statement that displays the following (by inserting the variables a and b ): “The teacher is Blase and he has 514.4 students” Note that you must round to 1 decimal place fprintf(‘The teacher is %s and he has %.1f students’,b,a) -2 for minor syntax errors -3 if they mix up %s and %f OR if they can’t round OR if they reverse b and a -5 if they mix up %s and %f AND ALSO can’t round

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

I- 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