{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# e2.s04 - ECE 199 Exam II Spring 2004 Tuesday April 6th 2004...

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

ECE 199 Exam II Spring 2004 Tuesday, April 6 th , 2004 x Be sure that your exam booklet has 13 pages. x Write your name at the top of each page. x This is a closed book exam. x You are allowed one handwritten 8.5" x 11" sheet of notes. x Absolutely no interaction between students is allowed. x Show all of your work. x Be sure to clearly indicate any assumptions that you make. x More challenging questions are marked with a *** x Don t panic, and good luck! Problem 1 20 points _______________________________ Problem 2 20 points _______________________________ Problem 3 20 points _______________________________ Problem 4 20 points _______________________________ Problem 5 20 points _______________________________ Total 100 points Name:

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

View Full Document
Page 2 Name: ____________________________________________ Problem 1 (20 points): Short Answer Part A (5 points): Give one reason for using local variables instead of global variables. Part B (5 points): Describe one advantage of using a debugger. Part C (5 points): Write the output of the following C code. for( i = 0 ; i < 4 ; i++) { if( i == 2 ) continue; for( j = 0 ; j < 4 ; j++){ if( j == 2 ) break; printf( "%d %d\n" , i , j ); } } Part D (5 points): You and a friend are charged with writing a function that reorganizes an array of integers by discarding any negative elements and adjusting the count of valid elements. Your friend proposes the following declaration: void keep_positive (int* array, int num_things); Explain why this declaration cannot serve the intended purpose.
Page 3 Name: ____________________________________________ Problem 2 (20 Points): Stacks and Traps in LC-3 Parts A and B of this problem both make use of the CHECK_X function described below. CHECK_X Description Inputs Outputs Checks if there are at least X elements on the stack, where X is a non-negative integer.

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.

{[ snackBarMessage ]}