fall2002_exam1_sol - EECS 370 Exam! fall '02 Sign the honor...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EECS 370 Exam! fall '02 Sign the honor code: I have neither given nor received aid on this exam nor observed anyone else doing so. Scores: Points /40 /15 /45 /100 # 1 2 3 Total NOTES: .Open book and Open notes .Calculators are allowed, but no PDAs, Portables, Cell phones, etc. .Don't spend too much time on anyone problem. .You have about 120 minutes for the exam. Page 1/13 EECS 370 Exam! fall '02 Section I: Short Answer What will be the result of execution of this program in LC2? Explain your answer. Be sure to indicate the value of any register that changes. (hint: 21626880 is 14AOOOO in hex). [5 points] .fil121626880 halt start ,.-JD.. .~ C!: e 3.7)4!::- F c -to P c. G::- ~~~ I) (r I'(\~'r\.; f.e-1 ~ f 2. Consider the following C structure. struct LinkedList { int element; struct LinkedList *next; } ; The following LC2K2 code is supposed to sum the value of all of the elements in the linked list. The pointer of the last element of the linked list points to location zero, and no other pointer points to that location. Fill in the missing gaps with the correct values to cause this program to work. [10 points] !oY: Load pointer to 1st element start 4 done 4 addLL done start first 1 addLL .(or 9 \ First e~ment of the link list pointer to the next element lw 0 3 add 0 beg l lw -3-- 2 add 2 4 lw ~ 3 beg 0 halt .fill +-~'r51- .fil14 .fill second .fill10 second (More of the data structure follows ~ Page 2/13 EECS 370 Exam! fall '02 3 Given the initial values located in memory locations 100-103, what are the final contents of the memory after the following MIPS instruction sequence is executed? [5 points] Ib $1, 100($0) Ihu$2,102($0) sw $2 100($0) sh $1 102($0) F:i.nal Memorv Contents Address 100 101 102 103 Value 4. Translate the following C program into MIPS assembly. Let $rl correspond to a and let $r2 correspond to b. If your program is longer than 6 instructions you will get zero points. [5 points] if (a>b) a=5j- else b++i 531- be t C9r .J dE>t/\..L o..d d ," ( e15e- ., ~-, Page 3/13 EECS 370 Exam! fall '02 5 Given below is a partial-MIPS function. Unfortunately, the author completely forgot to save and restore registers. Recall, that according to the MIPS calling convention, $si registers are designated as calle-save and $ti registers are caller-save (See pag~ A- 23 for additional details). At each label in the program (start_fn, before_jal, after_jal, end_in)...
View Full Document

This note was uploaded on 08/12/2008 for the course EECS 370 taught by Professor Bertacco during the Winter '08 term at University of Michigan.

Page1 / 12

fall2002_exam1_sol - EECS 370 Exam! fall '02 Sign the honor...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online