final_day2 - ECE 190 Final Exam Wednesday, May 11th, 2011...

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

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ECE 190 Final Exam Wednesday, May 11th, 2011 Problem 1 (5 points): Warmup Problem 2 (20 points): LC-3 Problem 3 (10 points): Debugging Problem 4 (10 points): Linked lists Problem 5 (15 points): Problem Solving • Be sure your exam booklet has 9 pages. • This is a closed book exam. • You are allowed four handwritten 8.5 x 11” sheets of notes. • Absolutely no interaction between students is allowed. • Don’t panic, and good luck! • Code must compile in order to receive credit! Students MUST compile their code using the provided make commands. It is highly recommended that you create backups of your code as you develop your solutions. 1 Warmup (5 points) For this problem, you will be implementing the save board function that transforms a board data structure into a binary file. The board file has the following binary format: • Each row of the board, in order, in the following format: – Cells of the row of the board in order, one byte per cell – A byte with value xFF • A sentinel byte with value xFF The board data structure is just like the data structure you worked with in MP5, except that the cells are chars instead of an enumerated data type (in standard C, a char is 1 byte): typedef struct { int rows ; / * Number of rows in the board * / int cols ; / * Number of columns in the board * / char * c e l l s ; / * Pointer to the board c e l l array (row- major layout ) * / } board ; Implementation Implement the save board function in file.c in the mp directory. To receive any credit for this problem, the code must compile. Testing To test, you must be in the mp directory. Run “make” to build the program. This will produce a test executable called “test save”, which when run will produce output files named output[0-2]. The expected outputs are in files named level[0-2]. For convenience, you can check if the output files match the expected ones by running “make test”. Recall that you can view the contents of a binary file with the hexdump utility: hexdump- C < file name > 2 LC-3 (20 points) Convert the following function from C to LC-3. This function inserts an element into a pre-existing doubly-linked list sorted into increasing order . Note that you may assume that element’s value is always greater than the head’s value and less than the the list’s tail value ....
View Full Document

This note was uploaded on 03/08/2012 for the course ECE 190 taught by Professor Hutchinson during the Spring '08 term at University of Illinois, Urbana Champaign.

Page1 / 8

final_day2 - ECE 190 Final Exam Wednesday, May 11th, 2011...

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

View Full Document
Ask a homework question - tutors are online