Engin77N%202001SP%20M1%20-

# Engin77N%202001SP%20M1%20- - University ofCalifornia,...

This preview shows pages 1–4. Sign up to view the full content.

University of California, Berkeley Spring Semester 200 1 E77N Midterm Examination #1 Monday February 26,2001 (You may refer to 1 sheet notes (8.5~11" ZxSided), NO CALCULATORS) Name: 6- (& Computer Lab Login Name*: ~77-& (*i/yorr don't remmkyour login nmte, the11 write the name you TA) Registered Lecture Section Sect1 (12-lpml) Sect.:! [I-2 pm] - - This exam has 5 Parts. For Part 5. YOU mv chaose do either 5A or SB. must choose one other, not both). Show all your work in space provided in this exam, write legibly, and double check dl answers. If get wk on a problem, move next problem then come back it. If gets cluttered please cirde final answer. Question 1: 2: 3: 4: 5: 3 ns points I /5 11 0 1. /15 Corrected by: init: -- Total: L6 /~~pints Jd 1 10

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

View Full Document
Question 1. For-loops and functions [35 points] Trace the following script file, which calls the function file test (defined below). Fill in table given below to show the values of variables i, a, and b at end every pass through loop. (Note that there may be more rows in table than necessary) - %This calculates for two variables, % a b lirnit=3 ; t a=O; b=l; c: for i=~:limit-1 (9 lip) [a,b]=test(~,%,i) ; (MI 1) a=a+l; @PI %What are values b and i here? end function [x,yl=test(a,b,c) x=a+c; o l z 1 5- y=(bA?) -c; I 0 I * r if Iy < 0 ) y=y+4;
Question 2. Computer Representation of Numbers [S pts]

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.

## Engin77N%202001SP%20M1%20- - University ofCalifornia,...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online