2008-09_midterm

2008-09_midterm - 1 University of Waterloo Midterm...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: 1 University of Waterloo Midterm Examination Fall 2008 Student Name: UW Student ID Number: UW Userid: Course Abbreviation and Number: CS 241 Course Title: Foundations of Sequential Programs Section(s): 001, 002, and 003 Instructor(s): Ond rej Lhot ak and J.P. Pretti Date of Exam: October 30, 2008 Time Period: Start time: 4:30 PM End Time: 6:30 PM Duration of Exam: 2 hours Number of Exam Pages: 13 (including this cover sheet) Exam Type: Closed Book Additional Materials Allowed: MIPS and MERL Reference Sheets Number/Character Conversion Reference Sheet If you believe there is an error in a question, please bring it to the attention to a proctor. He or she will report your concern to an instructor. Otherwise, clearly state any extra assumptions you feel necessary to answer a question. Marking Scheme Question Max Score 1 4 2 4 3 13 4 4 5 11 6 8 7 6 8 6 9 5 10 4 TOTAL 65 2 1. [4 marks] Short Answers Answer each of the following using no more than one or two sentences. (a) What is the minimum twos complement number that can be represented in four bits? (b) What is the maximum twos complement number that can be represented in four bits? (c) What does 10100100 represent? (d) How does an understanding of formal languages help in the creation of a compiler? 2. [4 marks] MIPS Machine Language Programming Translate the following MIPS assembly language program to MIPS machine language. Express your answer in hexadecimal in the spaces provided. .word -2 0x sub $9, $1, $7 0x sw $3, 8($9) 0x jr $31 0x ffff fffe 0027 4822 ad23 0008 03e0 0008 3 3. [13 marks] MIPS Assembly Language Programming Write MIPS assembly language programs to accomplish the following tasks. You may freely alter the values of any register without restoring them to their original contents. (a) [7 marks] Register 1 holds the address of the beginning of an array of 32-bit unsigned integers. Register 2 holds the number of elements in this array. Find the minimum element of the array and store it in register 3. Then return. Assume the array is not empty....
View Full Document

Page1 / 13

2008-09_midterm - 1 University of Waterloo Midterm...

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

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