Exam1key

Exam1key - D 5. C 6. B 7. D 8. C 9. A 10. A Question 2: $s0...

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

View Full Document Right Arrow Icon
CSE/EEE 230 Fall 2007 Exam 1 key Version 1a° Question 1 1. C 2. A 3. D 4. C 5. A 6. A 7. C 8. B 9. C 10. D Question 2: $s0 FFFFFFFF $s1 00000007 $s0 00000001 $s1 00000007 $s0 00000004 $s1 00000007 $s0 00000004 $s1 00000004 $s0 00000001 $s1 00000006 Question 3 a. 5 b. 8 c. 5 d. 8 e. Old $fp f. Clean up stack g. 10 h. 5 i. 3 j. 9 Question 4 Add $s0, $s0, $s1 Add $s0, $s0, $s2 Add $s1, $s1, $s0 Addi $s1, $s1, -2 Add $s2, $s0, $s2 Sll $s2, $s2, 1 bne $s0, $zero, next And $s2, $s2, $zero Next: addi $s1, $zero, 5 Slt $t1, $s0, $zero Beq $t1, $zero, else Add $s0, $s2, $zero J endif Else: add $s0, $s1, $zero Endif: Andi $s0, $0, 0 Addi $s1, $0, 4 Top: add $s0, $s0, $s2 Addi $s1, $s1, -1 Slt $t1, $0, $s1 Bne $t1, $0, top Add $s2, $0, $0 Addi $s0, $0, 1 Top: slt $t0, $s0, $s1 Beq $t0, $0, end Add $s2, $s2, $s0 Addi $s0, $s0, 1 J top Question 5 Max: slt $t0, $a0, $a1 Beq $t0, $0, seta0 Add $v0, $a1, $0 J return Seta0: add $v, $a0, $0 Return: jr $ra La $t0, val1 Lw $a0, ($t0) La $t0, val2 Lw $a1, ($t0) Jal max La $t0, result Sw $v0, ($t0)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Version 1b Question 1 1. A 2. C 3. C 4.
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: D 5. C 6. B 7. D 8. C 9. A 10. A Question 2: $s0 FFFFFFFF $s1 00000007 $s0 00000001 $s1 00000007 $s0 00000007 $s1 00000002 $s0 00000004 $s1 00000005 $s0 00000002 $s1 00000006 Question 3 a. 2 b. 8 c. 4 d. 7 e. Old $fp f. Clean up stack g. 10 h. 2 i. 1 j. 6 Question 4 Add $s0, $s0, $s1 Add $s0, $s0, $s2 Add $s1, $s1, $s0 Addi $s1, $s1, -3 Add $s2, $s0, $s2 Sll $s2, $s2, 2 bne $s0, $zero, next Addi $s2, $zero, 1 Next: addi $s1, $zero, 9 Slt $t1, $s0, $zero Beq $t1, $zero, else Add $s0, $s1, $zero J endif Else: add $s0, $s2, $zero Endif: Andi $s0, $0, 0 Addi $s1, $0, 6 Top: add $s0, $s0, $s2 Addi $s1, $s1, -2 Slt $t1, $0, $s1 Bne $t1, $0, top Addi $s2, $0, 100 Addi $s0, $0, 1 Top: slt $t0, $s0, $s1 Beq $t0, $0, end Add $s2, $s2, $s0 Addi $s0, $s0, 1 J top Question 5 Same as 1a solution...
View Full Document

Page1 / 2

Exam1key - D 5. C 6. B 7. D 8. C 9. A 10. A Question 2: $s0...

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

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