H- Written Questions- Solutions and RubricExam 1

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

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

View Full Document Right Arrow Icon
14:440:127, Fall 2008 Exam 1 Version H “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; a) a(d) exactly 0 b) length(b)>length(c) exactly 0 c) sum(a) less than 0 d) (c(6) > b(6)) & (c(6) > a(6)) exactly 0 e) c(6) > b(6)) | (c(6) > a(6)) greater than 0 (1) f) ( round(15.9) – fix(15.9) ) greater than 0 g) ~d exactly 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.36 students” Note that you must round to 2 decimal places fprintf(‘The teacher is %s and he has %.2f 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
Background image of page 1

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

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

Page1 / 3

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

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