Question

In: Computer Science

Assume that you have an array of 100 elements representing the grades students are stored in...

Assume that you have an array of 100 elements representing the grades students are stored in memory. Suppose the grades are in IEEE single precision format. Write a MIPS program to compute the average of the students grades and store the result in register $f0. Assume the array base address is stored in register $s0 and a floating point value of 100 is stored in memory with it address given in register $s2.

Solutions

Expert Solution

Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate the question. Thank You So Much.

code screenshot

copy to code

.data
grade: .float 90.2,81.8,64,58.2,78.3,88.7,57.6,83,89.7,75,76.2,69.6,87.7,75.7,87,86.9,52.3,95.6,88.9,85.4,91.9,96.2,78.9,90.5,99.5,85.7,99.6,71.8,99.6,80.9,96.8,83.9,81.1,96.8,53.3,66.6,69.3,53.7,92.3,77.8,70.3,77.3,53.8,63.3,94.3,89.8,68,58.6,85.5,80.1,88.7,72.4,92.6,64.2,62.6,88.6,61.7,66,60.3,56.2,56.6,72.8,60.8,54.9,60.3,80.1,93.5,80.6,56.5,75.3,86,87.9,98.3,56.1,92.3,89.4,62.9,55,80.1,86.1,80.8,59.9,79.1,92.9,51.1,91.9,52.6,62.4,52.7,77,86.1,74.4,98.8,57.3,99.4,80.4,97.9,82,94.6,65.9
size: .float 100.0
msg4: .asciiz "\nAverage of grades is : "


.text
.globl main
main:
#address of size
la $s2,size

#save address of array
la $s0,grade

#load size of 100
li $t1,100

#set index i=0
li $t0,0

add_loop:
#if i==100 jump to exit
beq $t0,$t1,addLoopExit

#get index of i
mul $t2,$t0,4

#get address of array[i]
add $t2,$t2,$s0

#load value from the address
l.s $f2,($t2)

#store number to sum
add.s $f0,$f0,$f2


#index++
addi $t0,$t0,1

#jump to loop
j add_loop

#break of loop
addLoopExit:

#load 100
l.s $f12,($s2)

#get average
div.s $f12,$f0,$f12

li   $v0, 4
la   $a0, msg4
syscall

#print float
li $v0,2
syscall

output


Related Solutions

Write a method that, given an array of grades stored as double values, computes and return...
Write a method that, given an array of grades stored as double values, computes and return their mean.    Write another method that will return an array of the mean grade obtained by an arbitrary number of student.    This method will take a 2-dimensional array of double values in which each row corresponds to the grade vector    for a different student. You can compute the mean for each row as you did before...    Once you are done,...
How have you handled conflicts with students over grades and assignments?
How have you handled conflicts with students over grades and assignments?
Instructions: Write a program to calculate students’ average test scores and their grades. You may assume...
Instructions: Write a program to calculate students’ average test scores and their grades. You may assume the following input data: Johnson 85 83 77 91 76 Aniston 80 90 95 93 48 Cooper 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Clark 60 85 45 39 67 Kennedy 77 31 52 74 83 Bronson 93 94 89 77 97 Sunny 79 85 28 93 82 Smith 85 72 49 75 63...
Grades on a standardized test are known to have a mean of 10901090 for students in...
Grades on a standardized test are known to have a mean of 10901090 for students in the United States. The test is administered to 458458 randomly selected students in​ Florida; in this​ sample, the mean is 1104.171104.17 and the standard deviation ​(s​) is 117.72117.72. Another 508508 students are selected at random from Florida. They are given a​ 3-hour preparation course before the test is administered. Their average test score is 1110.711110.71 with a standard deviation of 103.55103.55. The​ 95% confidence...
Grades on a standardized test are known to have a mean of 940 for students in...
Grades on a standardized test are known to have a mean of 940 for students in the United States. The test is administered to 436 randomly selected students in​ Florida; in this​ sample, the mean is 952.22 and the standard deviation ​(s​) is 101.52. The​ 95% confidence interval for the average test score for Florida students is ​(__ , __). ​(Round your responses to two decimal places.​)
Grades on a standardized test are known to have a mean of 940 for students in...
Grades on a standardized test are known to have a mean of 940 for students in the United States. The test is administered to 436 randomly selected students in​ Florida; in this​ sample, the mean is 952.22 and the standard deviation ​(s​) is 101.52. a) The​ 95% confidence interval for the average test score for Florida students is ​( 942.67​, 961.77​). ​(Round your responses to two decimal places.​) b) Is there statistically significant evidence that Florida students perform differently than...
) Grades on a standardized test are known to have a mean of 1000 for students...
) Grades on a standardized test are known to have a mean of 1000 for students in the US. The test is administered to 453 randomly selected students from Queens College, and they obtained an average grade of 1013 and a standard deviation of 108. a. Construct a 95 % confidence interval for the true average test score for Queens College students.(1pt) b. With 5% significance level, Is there a statistical evidence that Queens College students perform differently than other...
Grades on a standardized test are known to have a mean of 500 for students in...
Grades on a standardized test are known to have a mean of 500 for students in the US. The test is administered to 600 randomly selected students in Florida. In this subsample, the mean is 508, and the standard deviation is 75 i. Construct a 95% confidence interval for the average test score for students in Florida. ii. Is there statistically significant evidence that students in Florida perform differently from other students in the US? iii. Another 500 students are...
Suppose we have assigned grades for the 11 students in our data: Grade A for students...
Suppose we have assigned grades for the 11 students in our data: Grade A for students who scored ≥ 90; B for students who scored ≥ 80 and < 90; C for students who scored ≥ 70 and < 80; D for students who scored ≥ 60 and < 70; F for students who scored < 60. Following the above grade scheme, we observe that we have 8 students who received grade A, 2 student received grade B, 0 students...
You are given an array of n elements, and you notice that some of them are...
You are given an array of n elements, and you notice that some of them are duplicates, that is, they appear more than once in the array. Show how to remove all duplicates from the array in time O( n log2 n ).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT