Spring 2001 CS100M Exercise E2: Basic tracing due in Lecture, 2/1 Try to trace things by hand, on paper, away from the computer. If you get stuck, try running part of the code: just enough to get unstuck. At the end, you can get check your answers by running all the code in Matlab. Turn in your hand-traced answers for all three questions. 1. Use the tabular format to trace the following code: z = 1; for x = [3 1 4 6] w = z; for y = [2 7] z = z + w * y; if rem(z, 3) == 0 z = (z+0)/3; end end end 2. Use the box diagram memory model to trace the following code: genny.age = 13; genny.friends = 7; rosie = struct('age', genny.age-2, 'toys',8); junie = genny; genny.age = 14; y = junie.age; genny = rosie; junie.sister = rosie; 3. Use the box diagram memory model to trace the code: x = [ 5 1 4 8 2 6 3 9 7 ]; i = 3; for j = 1:5 i = x(i)+1; if i <= length(x) x(i) = x(i)+1; else x = [x j]; end end