F- Written Questions- Solutions and RubricExam 1

# F- 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 F “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<93 | y<92 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 one If Statement that does all of 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:

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.

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

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