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 DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 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: 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++) { i f ( i = = 2 ) c o n t i n u e ; f o r ( j = ; j < 4 ; j + + ) { i f ( j = = 2 ) b r e a k ; p r i n t f ( " % 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 LC3 Parts A and B of this problem both make use of the CHECK_X function described below....
View
Full
Document
This note was uploaded on 01/23/2012 for the course ECE 190 taught by Professor Hutchinson during the Spring '08 term at University of Illinois, Urbana Champaign.
 Spring '08
 Hutchinson

Click to edit the document details