Learn from Prelim 1

This was a challenging prelim! If you have done well, congratulations! If you have not done well, be sure to catch up and then you can show us at the next exams what you have learned! Remember, Prelim 1 is worth only 20% so you have plenty of opportunities to improve.

Question 1 (Trace, function scope)

Part (b) on function scope was well done! In the trace, Part (a), some students did not properly keep track of the changes to vector v and later in the loop just ended up using the original vector values instead of the updated values.

Question 2 (for-loop detail, linear interpolation)

Part (a): In Matlab for-loops, the loop variable's values are determined--cast in stone--when the loop guard is encountered. I.e., the loop variable's value in each iteration is fixed by the loop header. If you got this question wrong, you need to watch the MatTV episode "Troubleshooting Loops".

Part (b): This question on linear interpolation was mostly well done. The given code does NOT correctly interpolate the colors from colA to colB. Look closely at the calculation of the fraction... remember our discussion during lecture on moving from the continuous space to the discrete space? In part 2 of the question where you were to modify the code according to your answer in part 1, you got full credit as long as you wrote code correctly to match your part 1 answer and according to the specifications.

Question 3 (if-construct, boolean expression, random number generation)

Question 4 (developing an iterative algorithm, generating random integers, indefinite iteration, function and function call)

This was the most challenging question on the prelim. Part (b) on indefinite iteration and function call was generally well done, but part (a) where students had to come up with an iterative algorithm using the tools rem, division, and truncation (floor) was challenging for many.

(a) Writing a function, algorithm to count and sum the digits

(b) Indefinite iteration, generating random integers, calling a function

Question 5 (nested loops and algorithm for "finding the best in a set")

Statisics

Max: 98
Median: 75
Mean: 72.6
S.Dev: 16.2
% Action to take after prelim

if  yourScore > 85

    toDo= celebrate + later look at the solution

elseif  yourScore > 65

    toDo= redo problems + later check solution

else

    toDo= meet with course staff to go over exam ...
          + stay caught up from now on ...
          + do NOT just read the solution--must redo problems

end