midterm-practice-questions_update - CSE 378 Machine...

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

View Full Document Right Arrow Icon
CSE 378 Machine Architecture and Assembly Language PRACTICE QUESTIONS : 1) Programming in SPIM. Write a program in MIPS assembly language that finds (i)the number of elements strictly greater than the last element,(ii) the minimum element,(iii) the maximum element, and (iii) the (integer) average of all elements in an array of integers (each element is a 32-bit positive, negative, or null integer). Your input, the array and its size, should be in ".data" section of your program. As output, your program should display the 4 values asked for above on the console with appropriate messages. 2) Implement the following in MIPS: (i) forloop.c - A for loop int forloop(){ int i = 0; int result = 0; for (i; i<20; i=i+2){ result += i; } return result; } (ii) funccall.c - A function calling example int main(){ int a = 4; return helper(a); } int helper(int a){ int b = a * 4; return b; } (iii) strcat.c - C string concatenation function char* strcat (char * dst, char * src){ char* originalDst = dst; while(*dst){ dst++; }
Background image of page 1

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

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

This note was uploaded on 02/28/2012 for the course CSCE 3510 taught by Professor Unt during the Spring '12 term at North Texas.

Page1 / 3

midterm-practice-questions_update - CSE 378 Machine...

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