quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryهندسة الحاسبات schoolبكالوريوس event_available2026-07-15

السؤال

Transcribed Image Text:

Question 5 For the following C code, variables a, b, c, and n correspond to the registers $50, $s1, $s2 and $a0 respectively and i corresponds to $to. The callee doesn't have to preserve registers $t1-$19, if used. int iterFib(int n) { int a = 0, b = 1, c, i; for(i=2;i<n;i++) { c=a+b; a-b; b=c return b; What are the missing MIPS instructions? Please record only the letter in lower case. iterFib: addi $sp, $sp, -12 sw $50,8($sp) sw $51,4($sp) Instruction 1--- add $50, $zero, $zero addi $s1, $zero, 1 add $to, $zero, Szero addi St1, $a0, 1 forFib: sit $t2, $to, $t1 Instruction 2--- add $s2, $s1, $s2 add $50, $zero, $s1 add $s1. Szero, $s2 addi $to, $10, 1 jforFib exitFib: add $vo, Szero, Ss1 jr Sra 5p j forFib exitFib: add $v0, $zero, $s1 jr $ra Instruction 1 is a. No instruction b. addi $sp, $sp, 4 C. add $sp, $sp, -4 d. Iw $52,0($sp) e. sw $52,0($sp) f. bne $t2, $zero, exit Fib g. beq $t2, $zero, exitFib h. None of the above Instruction 2 is a. jiterFib b. addi $sp, $sp, 4 C. add $sp, $sp, -4 d. Iw $s0,0($sp) e. addi $sp, $sp, -4 f. bne $t2, $zero, exitFib g. beq $t2, $zero, exitFib h. None of the above MacBook Pro

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top