Question: For the following MIPS code: stuff: . word 1 4 , 0 , 9 , - 4 , 5 , - 7 , 1 2
For the following MIPS code:
stuff: word
# code to make this program load and such
move $s $zero
la $s stuff
addi $s $zero,
move $t $zero
top:
beq $s $zero, done
lw $t$s
beq $t $zero, p
addi $t $t
j p
p:
move $t $t
move $t $zero
slt $t $s $t
beq $t $zero, p
move $s $t
p:
addi $s $s
addi $s $s
j top
done:
What value will be in register s after the code has completed executing and what task does the function perform.
Question options:
s: Finds the largest element in the array.
s: This program computes the length of the longest sequence of numbers between occurences of
s: Finds the largest element in the list, and then computes the sum of all the values prior to that element.
s: This program computes the number of s in the array.
s: This program computes the shortest substring in the string.
s: Computes the sum of the array elements with positive values.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
