D- Written Questions- Solutions and RubricExam 1

D- 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 D “No Computer” Question 1: Answer whether the following questions evaluate to True or False : Let x = 100 and y = 15 a) y+5 >= 98 FALSE b) rem(x,y) > 3 TRUE c) fix(x/y) == 6 TRUE d) ~y FALSE e) length(x) == 3 FALSE (it’s a 1x1 matrix) f) x<100 | y<100 TRUE g) x ~= y TRUE Subtract 1 point for each incorrect answer. No partial credit is given for this question. “No Computer” Question 2: Write an If Statement that does the following. A) Displays “Both Positive” if both x and y are positive B) Displays “Both Negative” if both x and y are negative C) Displays “Different Signs” if x is positive and y negative, or vice versa D) However, if either x or y is zero, the if statement should only display “ZERO” You may assume that x and y have already been defined. if (x==0 | y==0) disp( 'ZERO' ) elseif disp( 'Both Positive' ) elseif disp( 'Both Negative' ) else disp( 'Different Signs' ) end OR You could have done this problem with the sign() function:
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.

This note was uploaded on 02/29/2012 for the course 440 127 taught by Professor Blase during the Fall '09 term at Rutgers.

Page1 / 3

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